@@ -16,16 +16,12 @@ |
||
16 | 16 | use PPI\LaravelRouting\LaravelRouter; |
17 | 17 | use PPI\FastRoute\Wrapper\FastRouteWrapper; |
18 | 18 | use PPI\Framework\Router\Loader\YamlFileLoader; |
19 | - |
|
20 | 19 | use Symfony\Component\Config\FileLocator; |
21 | 20 | use Symfony\Component\Finder\Finder; |
22 | - |
|
23 | 21 | use Zend\ModuleManager\Feature\ConfigProviderInterface; |
24 | 22 | use Zend\Stdlib\ArrayUtils; |
25 | - |
|
26 | 23 | use Aura\Router\Router as AuraRouter; |
27 | 24 | use Aura\Router\RouterFactory as AuraRouterFactory; |
28 | - |
|
29 | 25 | use Illuminate\Events\Dispatcher; |
30 | 26 | |
31 | 27 | /** |
@@ -1,12 +1,12 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * This file is part of the PPI Framework. |
|
4 | - * |
|
5 | - * @copyright Copyright (c) 2011-2013 Paul Dragoonis <[email protected]> |
|
6 | - * @license http://opensource.org/licenses/mit-license.php MIT |
|
7 | - * |
|
8 | - * @link http://www.ppi.io |
|
9 | - */ |
|
3 | + * This file is part of the PPI Framework. |
|
4 | + * |
|
5 | + * @copyright Copyright (c) 2011-2013 Paul Dragoonis <[email protected]> |
|
6 | + * @license http://opensource.org/licenses/mit-license.php MIT |
|
7 | + * |
|
8 | + * @link http://www.ppi.io |
|
9 | + */ |
|
10 | 10 | |
11 | 11 | namespace PPI\Framework\View; |
12 | 12 |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | $dataGenerator = new \FastRoute\DataGenerator\GroupCountBased(); |
138 | 138 | $routeCollector = new \FastRoute\RouteCollector($routeParser, $dataGenerator); |
139 | 139 | |
140 | - if(!is_readable($path)) { |
|
140 | + if (!is_readable($path)) { |
|
141 | 141 | throw new \InvalidArgumentException('Invalid fast route routes path found: ' . $path); |
142 | 142 | } |
143 | 143 | |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | }; |
150 | 150 | |
151 | 151 | $routeCollector = $getRouteCollector(); |
152 | - if(!($routeCollector instanceof \FastRoute\RouteCollector)) { |
|
152 | + if (!($routeCollector instanceof \FastRoute\RouteCollector)) { |
|
153 | 153 | throw new \Exception('Invalid return value from ' |
154 | 154 | . pathinfo($path, PATHINFO_FILENAME) |
155 | 155 | . ' expected instance of RouteCollector' |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | protected function loadAuraRoutes($path) |
176 | 176 | { |
177 | 177 | |
178 | - if(!is_readable($path)) { |
|
178 | + if (!is_readable($path)) { |
|
179 | 179 | throw new \InvalidArgumentException('Invalid aura routes path found: ' . $path); |
180 | 180 | } |
181 | 181 | |
@@ -184,14 +184,14 @@ discard block |
||
184 | 184 | // The included file must return the aura router |
185 | 185 | $router = include $path; |
186 | 186 | |
187 | - if(!($router instanceof AuraRouter)) { |
|
187 | + if (!($router instanceof AuraRouter)) { |
|
188 | 188 | throw new \Exception('Invalid return value from ' |
189 | 189 | . pathinfo($path, PATHINFO_FILENAME) |
190 | 190 | . ' expected instance of AuraRouter' |
191 | 191 | ); |
192 | 192 | } |
193 | 193 | |
194 | - foreach($router->getRoutes() as $route) { |
|
194 | + foreach ($router->getRoutes() as $route) { |
|
195 | 195 | $route->addValues(array('_module' => $this->getName())); |
196 | 196 | } |
197 | 197 |
@@ -1,12 +1,12 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * This file is part of the PPI Framework. |
|
4 | - * |
|
5 | - * @copyright Copyright (c) 2011-2013 Paul Dragoonis <[email protected]> |
|
6 | - * @license http://opensource.org/licenses/mit-license.php MIT |
|
7 | - * |
|
8 | - * @link http://www.ppi.io |
|
9 | - */ |
|
3 | + * This file is part of the PPI Framework. |
|
4 | + * |
|
5 | + * @copyright Copyright (c) 2011-2013 Paul Dragoonis <[email protected]> |
|
6 | + * @license http://opensource.org/licenses/mit-license.php MIT |
|
7 | + * |
|
8 | + * @link http://www.ppi.io |
|
9 | + */ |
|
10 | 10 | |
11 | 11 | namespace PPI\Framework\View; |
12 | 12 |
@@ -190,39 +190,39 @@ |
||
190 | 190 | |
191 | 191 | // Copy files relative to the selected templating engine |
192 | 192 | switch ($this->tplEngine) { |
193 | - case self::TPL_ENGINE_PHP: |
|
194 | - case self::TPL_ENGINE_TWIG: |
|
195 | - case self::TPL_ENGINE_SMARTY: |
|
196 | - // Copy templating files over |
|
197 | - $tplFiles = $this->tplEngineFilesMap[$this->tplEngine]; |
|
198 | - $this->copyFiles($this->skeletonModuleDir, $moduleDir, $tplFiles); |
|
199 | - // Setting up templating tokens |
|
200 | - foreach ($tplFiles as $tplFile) { |
|
201 | - $tokenizedFiles[] = $tplFile; |
|
202 | - } |
|
203 | - $tokens['[MODULE_NAME]'] = $moduleName; |
|
204 | - $tokens['[TPL_ENGINE_EXT]'] = $this->tplEngine; |
|
205 | - break; |
|
193 | + case self::TPL_ENGINE_PHP: |
|
194 | + case self::TPL_ENGINE_TWIG: |
|
195 | + case self::TPL_ENGINE_SMARTY: |
|
196 | + // Copy templating files over |
|
197 | + $tplFiles = $this->tplEngineFilesMap[$this->tplEngine]; |
|
198 | + $this->copyFiles($this->skeletonModuleDir, $moduleDir, $tplFiles); |
|
199 | + // Setting up templating tokens |
|
200 | + foreach ($tplFiles as $tplFile) { |
|
201 | + $tokenizedFiles[] = $tplFile; |
|
202 | + } |
|
203 | + $tokens['[MODULE_NAME]'] = $moduleName; |
|
204 | + $tokens['[TPL_ENGINE_EXT]'] = $this->tplEngine; |
|
205 | + break; |
|
206 | 206 | } |
207 | 207 | // Routing |
208 | 208 | switch ($this->routingEngine) { |
209 | - case self::ROUTING_ENGINE_SYMFONY: |
|
210 | - case self::ROUTING_ENGINE_AURA: |
|
211 | - case self::ROUTING_ENGINE_LARAVEL: |
|
212 | - case self::ROUTING_ENGINE_FASTROUTE: |
|
213 | - // Copy routing files over |
|
214 | - $routingFiles = $this->routingEngineFilesMap[$this->routingEngine]; |
|
215 | - $this->copyFiles($this->skeletonModuleDir, $moduleDir, $routingFiles); |
|
216 | - |
|
217 | - // Setting up routing tokens |
|
218 | - foreach ($routingFiles as $routingFile) { |
|
219 | - $tokenizedFiles[] = $routingFile; |
|
220 | - } |
|
221 | - $routingTokensMap = $this->routingEngineTokenMap[$this->routingEngine]; |
|
222 | - foreach ($routingTokensMap as $routingTokenKey => $routingTokenVal) { |
|
223 | - $tokens[$routingTokenKey] = $routingTokenVal; |
|
224 | - } |
|
225 | - break; |
|
209 | + case self::ROUTING_ENGINE_SYMFONY: |
|
210 | + case self::ROUTING_ENGINE_AURA: |
|
211 | + case self::ROUTING_ENGINE_LARAVEL: |
|
212 | + case self::ROUTING_ENGINE_FASTROUTE: |
|
213 | + // Copy routing files over |
|
214 | + $routingFiles = $this->routingEngineFilesMap[$this->routingEngine]; |
|
215 | + $this->copyFiles($this->skeletonModuleDir, $moduleDir, $routingFiles); |
|
216 | + |
|
217 | + // Setting up routing tokens |
|
218 | + foreach ($routingFiles as $routingFile) { |
|
219 | + $tokenizedFiles[] = $routingFile; |
|
220 | + } |
|
221 | + $routingTokensMap = $this->routingEngineTokenMap[$this->routingEngine]; |
|
222 | + foreach ($routingTokensMap as $routingTokenKey => $routingTokenVal) { |
|
223 | + $tokens[$routingTokenKey] = $routingTokenVal; |
|
224 | + } |
|
225 | + break; |
|
226 | 226 | } |
227 | 227 | |
228 | 228 | // Replace tokens in all files |
@@ -351,16 +351,16 @@ |
||
351 | 351 | private function checkRouters(InputInterface $input, OutputInterface $output) |
352 | 352 | { |
353 | 353 | // Aura Check |
354 | - if($this->routingEngine == self::ROUTING_ENGINE_AURA && !class_exists('\Aura\Router\Router')) { |
|
354 | + if ($this->routingEngine == self::ROUTING_ENGINE_AURA && !class_exists('\Aura\Router\Router')) { |
|
355 | 355 | $output->writeln("<comment>Aura Router doesn't appear to be loaded. Run: <info>composer require ppi/aura-router</info></comment>"); |
356 | 356 | } |
357 | 357 | |
358 | 358 | // Laravel check |
359 | - if($this->routingEngine == self::ROUTING_ENGINE_LARAVEL && !class_exists('\PPI\LaravelRouting\LaravelRouter')) { |
|
359 | + if ($this->routingEngine == self::ROUTING_ENGINE_LARAVEL && !class_exists('\PPI\LaravelRouting\LaravelRouter')) { |
|
360 | 360 | $output->writeln("<comment>Laravel Router doesn't appear to be loaded. Run: <info>composer require ppi/laravel-router</info></comment>"); |
361 | 361 | } |
362 | 362 | |
363 | - if($this->routingEngine == self::ROUTING_ENGINE_FASTROUTE && !class_exists('\PPI\FastRoute\FastRouteWrapper')) { |
|
363 | + if ($this->routingEngine == self::ROUTING_ENGINE_FASTROUTE && !class_exists('\PPI\FastRoute\FastRouteWrapper')) { |
|
364 | 364 | $output->writeln("<comment>Laravel Router doesn't appear to be loaded. Run: <info>composer require ppi/fast-route</info></comment>"); |
365 | 365 | } |
366 | 366 |
@@ -1,12 +1,12 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * This file is part of the PPI Framework. |
|
4 | - * |
|
5 | - * @copyright Copyright (c) 2011-2013 Paul Dragoonis <[email protected]> |
|
6 | - * @license http://opensource.org/licenses/mit-license.php MIT |
|
7 | - * |
|
8 | - * @link http://www.ppi.io |
|
9 | - */ |
|
3 | + * This file is part of the PPI Framework. |
|
4 | + * |
|
5 | + * @copyright Copyright (c) 2011-2013 Paul Dragoonis <[email protected]> |
|
6 | + * @license http://opensource.org/licenses/mit-license.php MIT |
|
7 | + * |
|
8 | + * @link http://www.ppi.io |
|
9 | + */ |
|
10 | 10 | |
11 | 11 | namespace PPI\Framework\ServiceManager; |
12 | 12 |
@@ -1,12 +1,12 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * This file is part of the PPI Framework. |
|
4 | - * |
|
5 | - * @copyright Copyright (c) 2011-2015 Paul Dragoonis <[email protected]> |
|
6 | - * @license http://opensource.org/licenses/mit-license.php MIT |
|
7 | - * |
|
8 | - * @link http://www.ppi.io |
|
9 | - */ |
|
3 | + * This file is part of the PPI Framework. |
|
4 | + * |
|
5 | + * @copyright Copyright (c) 2011-2015 Paul Dragoonis <[email protected]> |
|
6 | + * @license http://opensource.org/licenses/mit-license.php MIT |
|
7 | + * |
|
8 | + * @link http://www.ppi.io |
|
9 | + */ |
|
10 | 10 | |
11 | 11 | namespace PPI\Framework\ServiceManager; |
12 | 12 |
@@ -60,37 +60,37 @@ |
||
60 | 60 | |
61 | 61 | switch(true) { |
62 | 62 | // @todo - move this to a separate method() |
63 | - case $moduleRoutingResponse instanceof SymfonyRouteCollection: |
|
64 | - $sfRouter = new SymfonyRouter($requestContext, $moduleRoutingResponse, $routerOptions, $logger); |
|
65 | - $sfRouterWrapper = new SymfonyRouterWrapper($sfRouter); |
|
66 | - $chainRouter->add($sfRouterWrapper); |
|
67 | - break; |
|
68 | - |
|
69 | - // @todo - move this to a separate method() |
|
70 | - case $moduleRoutingResponse instanceof AuraRouter: |
|
71 | - $auraRouterWrapper = new AuraRouterWrapper($moduleRoutingResponse); |
|
72 | - $chainRouter->add($auraRouterWrapper); |
|
73 | - break; |
|
74 | - |
|
75 | - // @todo - move this to a separate method() |
|
76 | - case $moduleRoutingResponse instanceof LaravelRouter: |
|
77 | - $laravelRequest = new LaravelRequest(); |
|
78 | - $laravelUrlGenerator = new LaravelUrlGenerator($moduleRoutingResponse->getRoutes(), $laravelRequest); |
|
79 | - $laravelRouterWrapper = new LaravelRouterWrapper( |
|
80 | - $moduleRoutingResponse, $laravelRequest, $laravelUrlGenerator |
|
81 | - ); |
|
82 | - // @todo - solve this problem |
|
63 | + case $moduleRoutingResponse instanceof SymfonyRouteCollection: |
|
64 | + $sfRouter = new SymfonyRouter($requestContext, $moduleRoutingResponse, $routerOptions, $logger); |
|
65 | + $sfRouterWrapper = new SymfonyRouterWrapper($sfRouter); |
|
66 | + $chainRouter->add($sfRouterWrapper); |
|
67 | + break; |
|
68 | + |
|
69 | + // @todo - move this to a separate method() |
|
70 | + case $moduleRoutingResponse instanceof AuraRouter: |
|
71 | + $auraRouterWrapper = new AuraRouterWrapper($moduleRoutingResponse); |
|
72 | + $chainRouter->add($auraRouterWrapper); |
|
73 | + break; |
|
74 | + |
|
75 | + // @todo - move this to a separate method() |
|
76 | + case $moduleRoutingResponse instanceof LaravelRouter: |
|
77 | + $laravelRequest = new LaravelRequest(); |
|
78 | + $laravelUrlGenerator = new LaravelUrlGenerator($moduleRoutingResponse->getRoutes(), $laravelRequest); |
|
79 | + $laravelRouterWrapper = new LaravelRouterWrapper( |
|
80 | + $moduleRoutingResponse, $laravelRequest, $laravelUrlGenerator |
|
81 | + ); |
|
82 | + // @todo - solve this problem |
|
83 | 83 | // $laravelRouterWrapper->setModuleName($this->getName()); |
84 | - $chainRouter->add($laravelRouterWrapper); |
|
85 | - break; |
|
84 | + $chainRouter->add($laravelRouterWrapper); |
|
85 | + break; |
|
86 | 86 | |
87 | - case $moduleRoutingResponse instanceof FastRouteWrapper: |
|
88 | - $chainRouter->add($moduleRoutingResponse); |
|
89 | - break; |
|
87 | + case $moduleRoutingResponse instanceof FastRouteWrapper: |
|
88 | + $chainRouter->add($moduleRoutingResponse); |
|
89 | + break; |
|
90 | 90 | |
91 | - default: |
|
92 | - throw new \Exception('Unexpected routes value return from module: ' . $moduleName . |
|
93 | - '. found value of type: ' . gettype($moduleRoutingResponse)); |
|
91 | + default: |
|
92 | + throw new \Exception('Unexpected routes value return from module: ' . $moduleName . |
|
93 | + '. found value of type: ' . gettype($moduleRoutingResponse)); |
|
94 | 94 | } |
95 | 95 | } |
96 | 96 |