private function addInBootstrap($content, array &$options, $prependFile)
{
$file = null;
foreach ($options as $key => $option) {
if (preg_match('!--bootstrap-file\\s*(.*)!', $option, $matches)) {
$file = $matches[1];
unset($options[$key]);
}
if (preg_match('!-bf\\s*(.*)!', $option, $matches)) {
$file = $matches[1];
unset($options[$key]);
}
}
if (null !== $content && null !== $file) {
$origine = $file;
$originContent = file_get_contents($file);
$originContent = str_replace('__FILE__', "'{$origine}'", $content);
$originContent = str_replace('__DIR__', "'" . dirname($origine) . "'", $content);
$content = $originContent . '?><?php ' . $content;
file_put_contents($file, $content);
file_put_contents($prependFile, sprintf("<?php require_once '%s';?>", $file), FILE_APPEND);
}
array_push($options, sprintf('--bootstrap-file %s', $prependFile));
return $this;
}