From dfced75f800bcb77482d988a062eb126f5d594f9 Mon Sep 17 00:00:00 2001 From: Paul Dragoonis Date: Sun, 20 Mar 2016 20:51:21 +0000 Subject: [PATCH 1/2] Resolving issue when modules are created without routing --- src/Console/Command/ModuleCreateCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Console/Command/ModuleCreateCommand.php b/src/Console/Command/ModuleCreateCommand.php index 036c1cf..3d38a23 100644 --- a/src/Console/Command/ModuleCreateCommand.php +++ b/src/Console/Command/ModuleCreateCommand.php @@ -208,7 +208,7 @@ protected function execute(InputInterface $input, OutputInterface $output) $this->processRoutingFiles($tokenizedFiles, $tokens); $output->writeln(sprintf("Router: %s", $this->routingEngine)); } else { - $tokens['ROUTING_TRAIT'] = ''; + $tokens['[ROUTING_TRAIT]'] = ''; } // replace tokens from specified tokenizable files From 5ef5502eceb16129c67b5da1cb1580a8fe075ef0 Mon Sep 17 00:00:00 2001 From: Paul Dragoonis Date: Fri, 1 Apr 2016 12:31:45 +0100 Subject: [PATCH 2/2] phpdoc updates --- src/Console/Command/ModuleCreateCommand.php | 37 +++++++++++++++++++-- 1 file changed, 34 insertions(+), 3 deletions(-) diff --git a/src/Console/Command/ModuleCreateCommand.php b/src/Console/Command/ModuleCreateCommand.php index 3d38a23..5b038d8 100644 --- a/src/Console/Command/ModuleCreateCommand.php +++ b/src/Console/Command/ModuleCreateCommand.php @@ -147,6 +147,8 @@ public function setSkeletonModuleDir($moduleDir) /** * @param string $moduleDir + * + * @return void */ public function setTargetModuleDir($moduleDir) { @@ -155,6 +157,8 @@ public function setTargetModuleDir($moduleDir) /** * @param array $tplEngines + * + * @return void */ public function setEnabledTemplatingEngines(array $tplEngines) { @@ -162,6 +166,7 @@ public function setEnabledTemplatingEngines(array $tplEngines) } /** + * @return void */ protected function configure() { @@ -320,8 +325,10 @@ protected function askQuestions(InputInterface $input, OutputInterface $output) $this->chooseTemplatingEngine($input, $output); } - if($this->askForRouting($input, $output)) { - $this->chooseRouter($input, $output); + if($this->askForContoller($input, $output)) { + if($this->askForRouting($input, $output)) { + return $this->chooseRouter($input, $output); + } } } @@ -416,7 +423,7 @@ private function askForTemplating(InputInterface $input, OutputInterface $output private function askForRouting(InputInterface $input, OutputInterface $output) { $questionHelper = $this->getHelper('question'); - $question = new ConfirmationQuestion("Do you need routing? (yes/no):\n", false); + $question = new ConfirmationQuestion("Which router do you want? (yes/no):\n", false); return $questionHelper->ask($input, $output, $question); } @@ -439,6 +446,12 @@ private function chooseTemplatingEngine($input, $output) } } + /** + * @param InputInterface $input + * @param OutputInterface $output + * + * @return void + */ private function chooseRouter(InputInterface $input, OutputInterface $output) { $routingQuestion = new ChoiceQuestion('Choose your routing engine:', @@ -460,6 +473,11 @@ private function chooseRouter(InputInterface $input, OutputInterface $output) $this->routingEngine = $chosenRouter; } + /** + * @param $tplEngine + * + * @return void + */ private function getTemplatingFilesFromEngine($tplEngine) { if(!isset($this->tplEngineFilesMap[$tplEngine])) { @@ -467,6 +485,9 @@ private function getTemplatingFilesFromEngine($tplEngine) } } + /** + * @return void + */ private function processTemplatingFiles() { $tplFiles = $this->getTemplatingFilesFromEngine($this->tplEngine); @@ -495,6 +516,8 @@ private function processTemplatingFiles() /** * @throws \Exception + * + * @return void */ private function processRoutingFiles($tokenizedFiles, $tokens) { @@ -543,6 +566,9 @@ private function processRoutingFiles($tokenizedFiles, $tokens) } } + /** + * @return array + */ protected function getTokenizedCoreFiles() { $files = []; @@ -552,6 +578,11 @@ protected function getTokenizedCoreFiles() return $files; } + /** + * @param $routingEngine + * @return array + * @throws \Exception + */ private function getRoutingTokenMap($routingEngine) { // if(!isset($this->routingEngineTokenMap[$routingEngine])) {