private function processRoutingFiles($tokenizedFiles, $tokens)
{
if (!isset($this->routingEngineFilesMap[$this->routingEngine])) {
throw new \Exception('Routing engine not found in routing files map: ' . $this->routingEngine);
}
// Copy routing files over
$routingFiles = $this->routingEngineFilesMap[$this->routingEngine];
// If a valid routing engine and that's not null router
if ($this->routingEngine !== 99) {
// Create core routing directories
foreach ($this->routingEngineCoreFiles as $coreFile) {
@mkdir($this->moduleDir . DIRECTORY_SEPARATOR . $coreFile);
}
}
//var_dump(__METHOD__, __LINE__, $routingFiles); exit;
$this->copyFiles($this->skeletonModuleDir, $this->moduleDir, $routingFiles);
// Setting up routing tokenizable files
foreach ($routingFiles as $routingFile) {
$tokenizedFiles[] = $routingFile;
}
// Get all the tokens for this routing engine and the values the map to.
$routingTokensMap = $this->getRoutingTokenMap($this->routingEngine);
foreach ($routingTokensMap as $routingTokenKey => $routingTokenVal) {
$tokens[$routingTokenKey] = $routingTokenVal;
}
// Replace tokens in all files
$this->replaceTokensInFiles($this->moduleDir, $tokenizedFiles, $tokens);
// Replace the ROUTING placeholder with this heredoc
// Prepare the fastroute route file
if ($this->routingEngine === self::ROUTING_ENGINE_FASTROUTE) {
rename($moduleDir . DIRECTORY_SEPARATOR . $routingFiles[0], str_replace('IndexInvoke', 'Index', $moduleDir . DIRECTORY_SEPARATOR . $routingFiles[0]));
}
}