StackFormation\Preprocessor::replaceMarkers PHP Method

replaceMarkers() protected method

protected replaceMarkers ( $json )
    protected function replaceMarkers($json)
    {
        $markers = ['###TIMESTAMP###' => date(\DateTime::ISO8601)];
        $json = str_replace(array_keys($markers), array_values($markers), $json);
        $json = preg_replace_callback('/###ENV:([^#:]+)###/', function ($matches) {
            if (!getenv($matches[1])) {
                throw new \Exception("Environment variable '{$matches[1]}' not found");
            }
            return getenv($matches[1]);
        }, $json);
        return $json;
    }