protected function injectInclude($string, $basePath)
{
return preg_replace_callback('/###INCLUDE:(.+)/', function (array $matches) use($basePath) {
$file = $basePath . '/' . $matches[1];
# Parse ENV vars in file names...
$file = $this->replaceMarkers($file);
if (!is_file($file)) {
throw new FileNotFoundException("File {$file} not found");
}
$fileContent = file_get_contents($file);
$fileContent = trim($fileContent);
return $fileContent;
}, $string);
}