protected function copyTemplateToPlugin($templateFolder, $pluginName, array $replace = array(), $whitelistFiles = array())
{
$replace['PLUGINNAME'] = $pluginName;
$files = array_merge(Filesystem::globr($templateFolder, '*'), Filesystem::globr($templateFolder, '.*'));
foreach ($files as $file) {
$fileNamePlugin = str_replace($templateFolder, '', $file);
if (!empty($whitelistFiles) && !in_array($fileNamePlugin, $whitelistFiles)) {
continue;
}
if (is_dir($file)) {
$fileNamePlugin = $this->replaceContent($replace, $fileNamePlugin);
$this->createFolderWithinPluginIfNotExists($pluginName, $fileNamePlugin);
} else {
$template = file_get_contents($file);
$template = $this->replaceContent($replace, $template);
$fileNamePlugin = $this->replaceContent($replace, $fileNamePlugin);
$this->createFileWithinPluginIfNotExists($pluginName, $fileNamePlugin, $template);
}
}
}