@@ -14,16 +14,13 @@ |
||
| 14 | 14 | use PPI\Framework\Router\ChainRouter; |
| 15 | 15 | use Zend\ServiceManager\FactoryInterface; |
| 16 | 16 | use Zend\ServiceManager\ServiceLocatorInterface; |
| 17 | - |
|
| 18 | 17 | use PPI\Framework\Router\Router as SymfonyRouter; |
| 19 | 18 | use PPI\Framework\Router\Wrapper\SymfonyRouterWrapper; |
| 20 | 19 | use Symfony\Component\Routing\RouteCollection as SymfonyRouteCollection; |
| 21 | - |
|
| 22 | 20 | use Illuminate\Http\Request as LaravelRequest; |
| 23 | 21 | use Illuminate\Routing\Router as LaravelRouter; |
| 24 | 22 | use Illuminate\Routing\UrlGenerator as LaravelUrlGenerator; |
| 25 | 23 | use PPI\LaravelRouting\Wrapper\LaravelRouterWrapper; |
| 26 | - |
|
| 27 | 24 | use Aura\Router\Router as AuraRouter; |
| 28 | 25 | use PPI\Framework\Router\Wrapper\AuraRouterWrapper; |
| 29 | 26 | |
@@ -57,7 +57,7 @@ |
||
| 57 | 57 | // For each module, add a matching instance type to the chain router |
| 58 | 58 | foreach ($allModuleRoutes as $moduleName => $moduleRoutingResponse) { |
| 59 | 59 | |
| 60 | - switch(true) { |
|
| 60 | + switch (true) { |
|
| 61 | 61 | // @todo - move this to a separate method() |
| 62 | 62 | case $moduleRoutingResponse instanceof SymfonyRouteCollection: |
| 63 | 63 | $sfRouter = new SymfonyRouter($requestContext, $moduleRoutingResponse, $routerOptions, $logger); |
@@ -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 | |
@@ -11,7 +11,6 @@ |
||
| 11 | 11 | namespace PPI\Framework\ServiceManager\Factory; |
| 12 | 12 | |
| 13 | 13 | use PPI\Framework\Router\RouterListener; |
| 14 | -use Symfony\Component\Routing\RequestContext; |
|
| 15 | 14 | use Zend\ServiceManager\FactoryInterface; |
| 16 | 15 | use Zend\ServiceManager\ServiceLocatorInterface; |
| 17 | 16 | |
@@ -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 | |
@@ -25,7 +25,7 @@ |
||
| 25 | 25 | * |
| 26 | 26 | * @param ServiceLocatorInterface $serviceLocator |
| 27 | 27 | * |
| 28 | - * @return \PPI\Framework\Router\RouterListener |
|
| 28 | + * @return RequestContext |
|
| 29 | 29 | */ |
| 30 | 30 | public function createService(ServiceLocatorInterface $serviceLocator) |
| 31 | 31 | { |
@@ -61,7 +61,6 @@ |
||
| 61 | 61 | $defaults = $defaults['framework']['router']; |
| 62 | 62 | |
| 63 | 63 | return isset($config['framework']['router']) ? |
| 64 | - $this->mergeConfiguration($defaults, $config['framework']['router']) : |
|
| 65 | - $defaults; |
|
| 64 | + $this->mergeConfiguration($defaults, $config['framework']['router']) : $defaults; |
|
| 66 | 65 | } |
| 67 | 66 | } |
@@ -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 | |
@@ -70,7 +70,7 @@ |
||
| 70 | 70 | /** |
| 71 | 71 | * Renders a template. |
| 72 | 72 | * |
| 73 | - * @param mixed $name A template name |
|
| 73 | + * @param string $name A template name |
|
| 74 | 74 | * @param array $parameters An array of parameters to pass to the template |
| 75 | 75 | * |
| 76 | 76 | * @throws \InvalidArgumentException if the template does not exist |
@@ -112,7 +112,7 @@ |
||
| 112 | 112 | $moduleCreateCommand->setTargetModuleDir($config['module_listener_options']['module_paths'][0]); |
| 113 | 113 | |
| 114 | 114 | // Enabled templating engines |
| 115 | - if(isset($config['framework']['templating']['engines'])) { |
|
| 115 | + if (isset($config['framework']['templating']['engines'])) { |
|
| 116 | 116 | $moduleCreateCommand->setEnabledTemplatingEngines($config['framework']['templating']['engines']); |
| 117 | 117 | } |
| 118 | 118 | |
@@ -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 | |
@@ -124,7 +124,7 @@ |
||
| 124 | 124 | $output->write(sprintf('<info>%s</info> ', str_pad($id, $pad['id']))); |
| 125 | 125 | $output->write(sprintf('%s ', str_pad($line['type'], $pad['type']))); |
| 126 | 126 | if ('Alias' == $line['type']) { |
| 127 | - $output->write(sprintf('<comment>alias for</comment> <info>%s </info>', str_pad($line['class'], $pad['class']-10))); |
|
| 127 | + $output->write(sprintf('<comment>alias for</comment> <info>%s </info>', str_pad($line['class'], $pad['class'] - 10))); |
|
| 128 | 128 | } else { |
| 129 | 129 | $output->write(sprintf('%s ', str_pad($line['class'], $pad['class']))); |
| 130 | 130 | } |
@@ -70,7 +70,7 @@ |
||
| 70 | 70 | $parameters = parent::matchRequest($request); |
| 71 | 71 | $this->matchedRouteRequest = $request; |
| 72 | 72 | return $parameters; |
| 73 | - } catch(\Exception $e) { |
|
| 73 | + } catch (\Exception $e) { |
|
| 74 | 74 | throw $e; |
| 75 | 75 | } |
| 76 | 76 | } |
@@ -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\Router; |
| 12 | 12 | |
@@ -1,11 +1,11 @@ |
||
| 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 | - * @link http://www.ppi.io |
|
| 8 | - */ |
|
| 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 | + * @link http://www.ppi.io |
|
| 8 | + */ |
|
| 9 | 9 | |
| 10 | 10 | namespace PPI\Framework\Router\Wrapper; |
| 11 | 11 | |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | public function generate($name, $parameters = array(), $referenceType = self::ABSOLUTE_PATH) |
| 86 | 86 | { |
| 87 | 87 | $ret = $this->router->generate($name, $parameters); |
| 88 | - if($ret === false) { |
|
| 88 | + if ($ret === false) { |
|
| 89 | 89 | throw new RouteNotFoundException('Unable to generate route for: ' . $name); |
| 90 | 90 | } |
| 91 | 91 | return $ret; |
@@ -127,16 +127,16 @@ discard block |
||
| 127 | 127 | $routeParams = $matchedRoute->params; |
| 128 | 128 | |
| 129 | 129 | // The 'action' key always exists and defaults to the Route Name, so we check accordingly |
| 130 | - if(!isset($routeParams['controller']) && $routeParams['action'] === $matchedRoute->name) { |
|
| 130 | + if (!isset($routeParams['controller']) && $routeParams['action'] === $matchedRoute->name) { |
|
| 131 | 131 | throw new \Exception('Matched the route: ' . $matchedRoute->name . ' but unable to locate |
| 132 | 132 | any controller/action params to dispatch'); |
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | // We need _controller, to that symfony ControllerResolver can pick this up |
| 136 | - if(!isset($routeParams['_controller'])) { |
|
| 137 | - if(isset($routeParams['controller'])) { |
|
| 136 | + if (!isset($routeParams['_controller'])) { |
|
| 137 | + if (isset($routeParams['controller'])) { |
|
| 138 | 138 | $routeParams['_controller'] = $routeParams['controller']; |
| 139 | - } elseif(isset($routeParams['action'])) { |
|
| 139 | + } elseif (isset($routeParams['action'])) { |
|
| 140 | 140 | $routeParams['_controller'] = $routeParams['action']; |
| 141 | 141 | } else { |
| 142 | 142 | throw new \Exception('Unable to determine the controller from route: ' . $matchedRoute->name); |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | $routeParams['_route'] = $matchedRoute->name; |
| 147 | 147 | |
| 148 | 148 | // If the controller is an Object, and 'action' is defaulted to the route name - we default to __invoke |
| 149 | - if($routeParams['action'] === $matchedRoute->name) { |
|
| 149 | + if ($routeParams['action'] === $matchedRoute->name) { |
|
| 150 | 150 | $routeParams['action'] = '__invoke'; |
| 151 | 151 | } |
| 152 | 152 | |