@@ -421,6 +421,10 @@ |
||
| 421 | 421 | return $questionHelper->ask($input, $output, $question); |
| 422 | 422 | } |
| 423 | 423 | |
| 424 | + /** |
|
| 425 | + * @param InputInterface $input |
|
| 426 | + * @param OutputInterface $output |
|
| 427 | + */ |
|
| 424 | 428 | private function chooseTemplatingEngine($input, $output) |
| 425 | 429 | { |
| 426 | 430 | $tplQuestion = new ChoiceQuestion('Choose your templating engine [php]', |
@@ -561,13 +561,13 @@ |
||
| 561 | 561 | $tokenMap = []; |
| 562 | 562 | |
| 563 | 563 | switch($routingEngine) { |
| 564 | - case self::ROUTING_ENGINE_SYMFONY: |
|
| 565 | - $tokenMap['[ROUTING_TRAIT]'] = 'use \PPI\Framework\Module\Routing\SymfonyTrait;'; |
|
| 566 | - break; |
|
| 564 | + case self::ROUTING_ENGINE_SYMFONY: |
|
| 565 | + $tokenMap['[ROUTING_TRAIT]'] = 'use \PPI\Framework\Module\Routing\SymfonyTrait;'; |
|
| 566 | + break; |
|
| 567 | 567 | |
| 568 | - default: |
|
| 569 | - throw new \Exception('Unimplemented routing engine: ' . $routingEngine); |
|
| 570 | - break; |
|
| 568 | + default: |
|
| 569 | + throw new \Exception('Unimplemented routing engine: ' . $routingEngine); |
|
| 570 | + break; |
|
| 571 | 571 | } |
| 572 | 572 | |
| 573 | 573 | return $tokenMap; |
@@ -199,12 +199,12 @@ discard block |
||
| 199 | 199 | |
| 200 | 200 | $tokens['[MODULE_NAME]'] = $this->moduleName; |
| 201 | 201 | |
| 202 | - if(null !== $this->tplEngine && $this->isValidTemplatingEngine($this->tplEngine)) { |
|
| 202 | + if (null !== $this->tplEngine && $this->isValidTemplatingEngine($this->tplEngine)) { |
|
| 203 | 203 | $this->processTemplatingFiles(); |
| 204 | 204 | $output->writeln(sprintf("Templating: <info>%s</info>", $this->tplEngine)); |
| 205 | 205 | } |
| 206 | 206 | |
| 207 | - if($this->isValidRoutingEngine($this->routingEngine)) { |
|
| 207 | + if ($this->isValidRoutingEngine($this->routingEngine)) { |
|
| 208 | 208 | $this->processRoutingFiles($tokenizedFiles, $tokens); |
| 209 | 209 | $output->writeln(sprintf("Router: <info>%s</info>", $this->routingEngine)); |
| 210 | 210 | } else { |
@@ -316,11 +316,11 @@ discard block |
||
| 316 | 316 | $this->modulesDir = $questionHelper->ask($input, $output, $modulesDirQuestion); |
| 317 | 317 | } |
| 318 | 318 | |
| 319 | - if($this->askForTemplating($input, $output)) { |
|
| 319 | + if ($this->askForTemplating($input, $output)) { |
|
| 320 | 320 | $this->chooseTemplatingEngine($input, $output); |
| 321 | 321 | } |
| 322 | 322 | |
| 323 | - if($this->askForRouting($input, $output)) { |
|
| 323 | + if ($this->askForRouting($input, $output)) { |
|
| 324 | 324 | $this->chooseRouter($input, $output); |
| 325 | 325 | } |
| 326 | 326 | } |
@@ -434,7 +434,7 @@ discard block |
||
| 434 | 434 | ] |
| 435 | 435 | ); |
| 436 | 436 | $tplQuestion->setErrorMessage('Templating engine %s is invalid.'); |
| 437 | - if(99 !== ($tplEngine = $this->getHelper('question')->ask($input, $output, $tplQuestion))) { |
|
| 437 | + if (99 !== ($tplEngine = $this->getHelper('question')->ask($input, $output, $tplQuestion))) { |
|
| 438 | 438 | $this->tplEngine = $tplEngine; |
| 439 | 439 | } |
| 440 | 440 | } |
@@ -454,7 +454,7 @@ discard block |
||
| 454 | 454 | // @todo - test question when you don't choose any option, or an invalid one (like -1) |
| 455 | 455 | $routingQuestion->setErrorMessage('Routing engine %s is invalid.'); |
| 456 | 456 | $chosenRouter = $this->getHelper('question')->ask($input, $output, $routingQuestion); |
| 457 | - if(99 == $chosenRouter) { |
|
| 457 | + if (99 == $chosenRouter) { |
|
| 458 | 458 | $chosenRouter = 'NullRouter'; |
| 459 | 459 | } |
| 460 | 460 | $this->routingEngine = $chosenRouter; |
@@ -462,7 +462,7 @@ discard block |
||
| 462 | 462 | |
| 463 | 463 | private function getTemplatingFilesFromEngine($tplEngine) |
| 464 | 464 | { |
| 465 | - if(!isset($this->tplEngineFilesMap[$tplEngine])) { |
|
| 465 | + if (!isset($this->tplEngineFilesMap[$tplEngine])) { |
|
| 466 | 466 | throw new \InvalidArgumentException('Invalid templating engine specified for map files: ' . $tplEngine); |
| 467 | 467 | } |
| 468 | 468 | } |
@@ -472,7 +472,7 @@ discard block |
||
| 472 | 472 | $tplFiles = $this->getTemplatingFilesFromEngine($this->tplEngine); |
| 473 | 473 | |
| 474 | 474 | // Copy core templating files over |
| 475 | - foreach($this->tplEngineCoreFiles as $coreFile) { |
|
| 475 | + foreach ($this->tplEngineCoreFiles as $coreFile) { |
|
| 476 | 476 | $tplFiles[] = $coreFile; |
| 477 | 477 | } |
| 478 | 478 | |
@@ -499,7 +499,7 @@ discard block |
||
| 499 | 499 | private function processRoutingFiles($tokenizedFiles, $tokens) |
| 500 | 500 | { |
| 501 | 501 | |
| 502 | - if(!isset($this->routingEngineFilesMap[$this->routingEngine])) { |
|
| 502 | + if (!isset($this->routingEngineFilesMap[$this->routingEngine])) { |
|
| 503 | 503 | throw new \Exception('Routing engine not found in routing files map: ' . $this->routingEngine); |
| 504 | 504 | } |
| 505 | 505 | |
@@ -507,9 +507,9 @@ discard block |
||
| 507 | 507 | $routingFiles = $this->routingEngineFilesMap[$this->routingEngine]; |
| 508 | 508 | |
| 509 | 509 | // If a valid routing engine and that's not null router |
| 510 | - if($this->routingEngine !== 99) { |
|
| 510 | + if ($this->routingEngine !== 99) { |
|
| 511 | 511 | // Create core routing directories |
| 512 | - foreach($this->routingEngineCoreFiles as $coreFile) { |
|
| 512 | + foreach ($this->routingEngineCoreFiles as $coreFile) { |
|
| 513 | 513 | @mkdir($this->moduleDir . DIRECTORY_SEPARATOR . $coreFile); |
| 514 | 514 | } |
| 515 | 515 | } |
@@ -560,7 +560,7 @@ discard block |
||
| 560 | 560 | |
| 561 | 561 | $tokenMap = []; |
| 562 | 562 | |
| 563 | - switch($routingEngine) { |
|
| 563 | + switch ($routingEngine) { |
|
| 564 | 564 | case self::ROUTING_ENGINE_SYMFONY: |
| 565 | 565 | $tokenMap['[ROUTING_TRAIT]'] = 'use \PPI\Framework\Module\Routing\SymfonyTrait;'; |
| 566 | 566 | break; |