@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | protected function execute(InputInterface $input, OutputInterface $output) |
188 | 188 | { |
189 | 189 | $this->moduleName = $input->getArgument('name'); |
190 | - $this->moduleDir = $this->modulesDir . DIRECTORY_SEPARATOR . $this->moduleName; |
|
190 | + $this->moduleDir = $this->modulesDir.DIRECTORY_SEPARATOR.$this->moduleName; |
|
191 | 191 | |
192 | 192 | // Acquire Module Information |
193 | 193 | $this->askQuestions($input, $output); |
@@ -204,12 +204,12 @@ discard block |
||
204 | 204 | |
205 | 205 | $tokens['[MODULE_NAME]'] = $this->moduleName; |
206 | 206 | |
207 | - if(null !== $this->tplEngine && $this->isValidTemplatingEngine($this->tplEngine)) { |
|
207 | + if (null !== $this->tplEngine && $this->isValidTemplatingEngine($this->tplEngine)) { |
|
208 | 208 | $this->processTemplatingFiles(); |
209 | 209 | $output->writeln(sprintf("Templating: <info>%s</info>", $this->tplEngine)); |
210 | 210 | } |
211 | 211 | |
212 | - if($this->isValidRoutingEngine($this->routingEngine)) { |
|
212 | + if ($this->isValidRoutingEngine($this->routingEngine)) { |
|
213 | 213 | $this->processRoutingFiles($tokenizedFiles, $tokens); |
214 | 214 | $output->writeln(sprintf("Router: <info>%s</info>", $this->routingEngine)); |
215 | 215 | } else { |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | protected function replaceTokensInFiles($moduleDir, $files, $tokens) |
256 | 256 | { |
257 | 257 | foreach ($files as $file) { |
258 | - $file = $moduleDir . DIRECTORY_SEPARATOR . $file; |
|
258 | + $file = $moduleDir.DIRECTORY_SEPARATOR.$file; |
|
259 | 259 | if (!is_writeable($file)) { |
260 | 260 | throw new \InvalidArgumentException(sprintf('File %s is not writeable', $file)); |
261 | 261 | } |
@@ -273,8 +273,8 @@ discard block |
||
273 | 273 | protected function copyFiles($skeletonDir, $moduleDir, $files) |
274 | 274 | { |
275 | 275 | foreach ($files as $file) { |
276 | - $srcFile = $skeletonDir . DIRECTORY_SEPARATOR . $file; |
|
277 | - $dstFile = $moduleDir . DIRECTORY_SEPARATOR . $file; |
|
276 | + $srcFile = $skeletonDir.DIRECTORY_SEPARATOR.$file; |
|
277 | + $dstFile = $moduleDir.DIRECTORY_SEPARATOR.$file; |
|
278 | 278 | if (!file_exists($srcFile)) { |
279 | 279 | throw new \InvalidArgumentException(sprintf('File does not exist: %s', $srcFile)); |
280 | 280 | } |
@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | |
302 | 302 | // Create base structure |
303 | 303 | foreach ($this->coreDirs as $coreDir) { |
304 | - $tmpDir = $moduleDir . DIRECTORY_SEPARATOR . $coreDir; |
|
304 | + $tmpDir = $moduleDir.DIRECTORY_SEPARATOR.$coreDir; |
|
305 | 305 | @mkdir($tmpDir); |
306 | 306 | } |
307 | 307 | } |
@@ -321,12 +321,12 @@ discard block |
||
321 | 321 | $this->modulesDir = $questionHelper->ask($input, $output, $modulesDirQuestion); |
322 | 322 | } |
323 | 323 | |
324 | - if($this->askForTemplating($input, $output)) { |
|
324 | + if ($this->askForTemplating($input, $output)) { |
|
325 | 325 | $this->chooseTemplatingEngine($input, $output); |
326 | 326 | } |
327 | 327 | |
328 | - if($this->askForContoller($input, $output)) { |
|
329 | - if($this->askForRouting($input, $output)) { |
|
328 | + if ($this->askForContoller($input, $output)) { |
|
329 | + if ($this->askForRouting($input, $output)) { |
|
330 | 330 | return $this->chooseRouter($input, $output); |
331 | 331 | } |
332 | 332 | } |
@@ -441,7 +441,7 @@ discard block |
||
441 | 441 | ] |
442 | 442 | ); |
443 | 443 | $tplQuestion->setErrorMessage('Templating engine %s is invalid.'); |
444 | - if(99 !== ($tplEngine = $this->getHelper('question')->ask($input, $output, $tplQuestion))) { |
|
444 | + if (99 !== ($tplEngine = $this->getHelper('question')->ask($input, $output, $tplQuestion))) { |
|
445 | 445 | $this->tplEngine = $tplEngine; |
446 | 446 | } |
447 | 447 | } |
@@ -467,7 +467,7 @@ discard block |
||
467 | 467 | // @todo - test question when you don't choose any option, or an invalid one (like -1) |
468 | 468 | $routingQuestion->setErrorMessage('Routing engine %s is invalid.'); |
469 | 469 | $chosenRouter = $this->getHelper('question')->ask($input, $output, $routingQuestion); |
470 | - if(99 == $chosenRouter) { |
|
470 | + if (99 == $chosenRouter) { |
|
471 | 471 | $chosenRouter = 'NullRouter'; |
472 | 472 | } |
473 | 473 | $this->routingEngine = $chosenRouter; |
@@ -480,8 +480,8 @@ discard block |
||
480 | 480 | */ |
481 | 481 | private function getTemplatingFilesFromEngine($tplEngine) |
482 | 482 | { |
483 | - if(!isset($this->tplEngineFilesMap[$tplEngine])) { |
|
484 | - throw new \InvalidArgumentException('Invalid templating engine specified for map files: ' . $tplEngine); |
|
483 | + if (!isset($this->tplEngineFilesMap[$tplEngine])) { |
|
484 | + throw new \InvalidArgumentException('Invalid templating engine specified for map files: '.$tplEngine); |
|
485 | 485 | } |
486 | 486 | } |
487 | 487 | |
@@ -493,7 +493,7 @@ discard block |
||
493 | 493 | $tplFiles = $this->getTemplatingFilesFromEngine($this->tplEngine); |
494 | 494 | |
495 | 495 | // Copy core templating files over |
496 | - foreach($this->tplEngineCoreFiles as $coreFile) { |
|
496 | + foreach ($this->tplEngineCoreFiles as $coreFile) { |
|
497 | 497 | $tplFiles[] = $coreFile; |
498 | 498 | } |
499 | 499 | |
@@ -522,18 +522,18 @@ discard block |
||
522 | 522 | private function processRoutingFiles($tokenizedFiles, $tokens) |
523 | 523 | { |
524 | 524 | |
525 | - if(!isset($this->routingEngineFilesMap[$this->routingEngine])) { |
|
526 | - throw new \Exception('Routing engine not found in routing files map: ' . $this->routingEngine); |
|
525 | + if (!isset($this->routingEngineFilesMap[$this->routingEngine])) { |
|
526 | + throw new \Exception('Routing engine not found in routing files map: '.$this->routingEngine); |
|
527 | 527 | } |
528 | 528 | |
529 | 529 | // Copy routing files over |
530 | 530 | $routingFiles = $this->routingEngineFilesMap[$this->routingEngine]; |
531 | 531 | |
532 | 532 | // If a valid routing engine and that's not null router |
533 | - if($this->routingEngine !== 99) { |
|
533 | + if ($this->routingEngine !== 99) { |
|
534 | 534 | // Create core routing directories |
535 | - foreach($this->routingEngineCoreFiles as $coreFile) { |
|
536 | - @mkdir($this->moduleDir . DIRECTORY_SEPARATOR . $coreFile); |
|
535 | + foreach ($this->routingEngineCoreFiles as $coreFile) { |
|
536 | + @mkdir($this->moduleDir.DIRECTORY_SEPARATOR.$coreFile); |
|
537 | 537 | } |
538 | 538 | } |
539 | 539 | |
@@ -560,8 +560,8 @@ discard block |
||
560 | 560 | // Prepare the fastroute route file |
561 | 561 | if ($this->routingEngine === self::ROUTING_ENGINE_FASTROUTE) { |
562 | 562 | rename( |
563 | - $moduleDir . DIRECTORY_SEPARATOR . $routingFiles[0], |
|
564 | - str_replace('IndexInvoke', 'Index', $moduleDir . DIRECTORY_SEPARATOR . $routingFiles[0] |
|
563 | + $moduleDir.DIRECTORY_SEPARATOR.$routingFiles[0], |
|
564 | + str_replace('IndexInvoke', 'Index', $moduleDir.DIRECTORY_SEPARATOR.$routingFiles[0] |
|
565 | 565 | )); |
566 | 566 | } |
567 | 567 | } |
@@ -591,13 +591,13 @@ discard block |
||
591 | 591 | |
592 | 592 | $tokenMap = []; |
593 | 593 | |
594 | - switch($routingEngine) { |
|
594 | + switch ($routingEngine) { |
|
595 | 595 | case self::ROUTING_ENGINE_SYMFONY: |
596 | 596 | $tokenMap['[ROUTING_TRAIT]'] = 'use \PPI\Framework\Module\Routing\SymfonyTrait;'; |
597 | 597 | break; |
598 | 598 | |
599 | 599 | default: |
600 | - throw new \Exception('Unimplemented routing engine: ' . $routingEngine); |
|
600 | + throw new \Exception('Unimplemented routing engine: '.$routingEngine); |
|
601 | 601 | break; |
602 | 602 | } |
603 | 603 |