@@ -403,7 +403,7 @@ discard block |
||
| 403 | 403 | /** |
| 404 | 404 | * @note Added for compatibility with Symfony's HttpKernel\Kernel. |
| 405 | 405 | * |
| 406 | - * @return null|ServiceManager\ServiceManager |
|
| 406 | + * @return ServiceManager\ServiceManager |
|
| 407 | 407 | */ |
| 408 | 408 | public function getContainer() |
| 409 | 409 | { |
@@ -601,7 +601,7 @@ discard block |
||
| 601 | 601 | /** |
| 602 | 602 | * Creates and initializes a ServiceManager instance. |
| 603 | 603 | * |
| 604 | - * @return ServiceManager The compiled service manager |
|
| 604 | + * @return ServiceManagerBuilder The compiled service manager |
|
| 605 | 605 | */ |
| 606 | 606 | protected function buildServiceManager() |
| 607 | 607 | { |
@@ -651,7 +651,7 @@ discard block |
||
| 651 | 651 | /** |
| 652 | 652 | * Logs with an arbitrary level. |
| 653 | 653 | * |
| 654 | - * @param mixed $level |
|
| 654 | + * @param string $level |
|
| 655 | 655 | * @param string $message |
| 656 | 656 | * @param array $context |
| 657 | 657 | */ |
@@ -14,7 +14,6 @@ |
||
| 14 | 14 | use Symfony\Component\Routing\Matcher\UrlMatcher as UrlMatcher; |
| 15 | 15 | use Symfony\Component\Routing\Route as Route; |
| 16 | 16 | use Symfony\Component\Routing\RouteCollection; |
| 17 | -use Symfony\Component\Routing\Router; |
|
| 18 | 17 | |
| 19 | 18 | /** |
| 20 | 19 | * The PPI MicroApp bootstrap class. |
@@ -10,7 +10,6 @@ |
||
| 10 | 10 | |
| 11 | 11 | namespace PPI\Framework\Router\Loader; |
| 12 | 12 | |
| 13 | -use Illuminate\Routing\Router; |
|
| 14 | 13 | use Illuminate\Routing\Router as LaravelRouter; |
| 15 | 14 | |
| 16 | 15 | /** |
@@ -122,7 +122,7 @@ |
||
| 122 | 122 | protected function getResourcesPath($module) |
| 123 | 123 | { |
| 124 | 124 | if (is_callable(array($module, 'getResourcesPath'))) { |
| 125 | - $resourcesPath = $module->getResourcesPath(); |
|
| 125 | + $resourcesPath = $module->getResourcesPath(); |
|
| 126 | 126 | } else { |
| 127 | 127 | $resourcesPath = $module->getPath(); |
| 128 | 128 | } |
@@ -144,7 +144,7 @@ |
||
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | // The included file must return the laravel router |
| 147 | - $getRouteCollector = function () use ($routeCollector, $path) { |
|
| 147 | + $getRouteCollector = function() use ($routeCollector, $path) { |
|
| 148 | 148 | $r = $routeCollector; |
| 149 | 149 | include $path; |
| 150 | 150 | |
@@ -58,37 +58,37 @@ |
||
| 58 | 58 | foreach ($allModuleRoutes as $moduleName => $moduleRoutingResponse) { |
| 59 | 59 | switch (true) { |
| 60 | 60 | // @todo - move this to a separate method() |
| 61 | - case $moduleRoutingResponse instanceof SymfonyRouteCollection: |
|
| 62 | - $sfRouter = new SymfonyRouter($requestContext, $moduleRoutingResponse, $routerOptions, $logger); |
|
| 63 | - $sfRouterWrapper = new SymfonyRouterWrapper($sfRouter); |
|
| 64 | - $chainRouter->add($sfRouterWrapper); |
|
| 65 | - break; |
|
| 61 | + case $moduleRoutingResponse instanceof SymfonyRouteCollection: |
|
| 62 | + $sfRouter = new SymfonyRouter($requestContext, $moduleRoutingResponse, $routerOptions, $logger); |
|
| 63 | + $sfRouterWrapper = new SymfonyRouterWrapper($sfRouter); |
|
| 64 | + $chainRouter->add($sfRouterWrapper); |
|
| 65 | + break; |
|
| 66 | 66 | |
| 67 | - // @todo - move this to a separate method() |
|
| 68 | - case $moduleRoutingResponse instanceof AuraRouter: |
|
| 69 | - $auraRouterWrapper = new AuraRouterWrapper($moduleRoutingResponse); |
|
| 70 | - $chainRouter->add($auraRouterWrapper); |
|
| 71 | - break; |
|
| 67 | + // @todo - move this to a separate method() |
|
| 68 | + case $moduleRoutingResponse instanceof AuraRouter: |
|
| 69 | + $auraRouterWrapper = new AuraRouterWrapper($moduleRoutingResponse); |
|
| 70 | + $chainRouter->add($auraRouterWrapper); |
|
| 71 | + break; |
|
| 72 | 72 | |
| 73 | - // @todo - move this to a separate method() |
|
| 74 | - case $moduleRoutingResponse instanceof LaravelRouter: |
|
| 75 | - $laravelRequest = new LaravelRequest(); |
|
| 76 | - $laravelUrlGenerator = new LaravelUrlGenerator($moduleRoutingResponse->getRoutes(), $laravelRequest); |
|
| 77 | - $laravelRouterWrapper = new LaravelRouterWrapper( |
|
| 78 | - $moduleRoutingResponse, $laravelRequest, $laravelUrlGenerator |
|
| 79 | - ); |
|
| 80 | - // @todo - solve this problem |
|
| 73 | + // @todo - move this to a separate method() |
|
| 74 | + case $moduleRoutingResponse instanceof LaravelRouter: |
|
| 75 | + $laravelRequest = new LaravelRequest(); |
|
| 76 | + $laravelUrlGenerator = new LaravelUrlGenerator($moduleRoutingResponse->getRoutes(), $laravelRequest); |
|
| 77 | + $laravelRouterWrapper = new LaravelRouterWrapper( |
|
| 78 | + $moduleRoutingResponse, $laravelRequest, $laravelUrlGenerator |
|
| 79 | + ); |
|
| 80 | + // @todo - solve this problem |
|
| 81 | 81 | // $laravelRouterWrapper->setModuleName($this->getName()); |
| 82 | - $chainRouter->add($laravelRouterWrapper); |
|
| 83 | - break; |
|
| 82 | + $chainRouter->add($laravelRouterWrapper); |
|
| 83 | + break; |
|
| 84 | 84 | |
| 85 | - case $moduleRoutingResponse instanceof FastRouteWrapper: |
|
| 86 | - $chainRouter->add($moduleRoutingResponse); |
|
| 87 | - break; |
|
| 85 | + case $moduleRoutingResponse instanceof FastRouteWrapper: |
|
| 86 | + $chainRouter->add($moduleRoutingResponse); |
|
| 87 | + break; |
|
| 88 | 88 | |
| 89 | - default: |
|
| 90 | - throw new \Exception('Unexpected routes value return from module: ' . $moduleName . |
|
| 91 | - '. found value of type: ' . gettype($moduleRoutingResponse)); |
|
| 89 | + default: |
|
| 90 | + throw new \Exception('Unexpected routes value return from module: ' . $moduleName . |
|
| 91 | + '. found value of type: ' . gettype($moduleRoutingResponse)); |
|
| 92 | 92 | } |
| 93 | 93 | } |
| 94 | 94 | |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | $value = array($value); |
| 174 | 174 | } |
| 175 | 175 | |
| 176 | - if (! is_array($value) || ! $this->arrayContainsOnlyStrings($value)) { |
|
| 176 | + if (!is_array($value) || !$this->arrayContainsOnlyStrings($value)) { |
|
| 177 | 177 | throw new InvalidArgumentException( |
| 178 | 178 | 'Invalid header value; must be a string or array of strings' |
| 179 | 179 | ); |
@@ -212,13 +212,13 @@ discard block |
||
| 212 | 212 | $value = array($value); |
| 213 | 213 | } |
| 214 | 214 | |
| 215 | - if (! is_array($value) || ! $this->arrayContainsOnlyStrings($value)) { |
|
| 215 | + if (!is_array($value) || !$this->arrayContainsOnlyStrings($value)) { |
|
| 216 | 216 | throw new InvalidArgumentException( |
| 217 | 217 | 'Invalid header value; must be a string or array of strings' |
| 218 | 218 | ); |
| 219 | 219 | } |
| 220 | 220 | |
| 221 | - if (! $this->hasHeader($header)) { |
|
| 221 | + if (!$this->hasHeader($header)) { |
|
| 222 | 222 | return $this->withHeader($header, $value); |
| 223 | 223 | } |
| 224 | 224 | |
@@ -246,7 +246,7 @@ discard block |
||
| 246 | 246 | */ |
| 247 | 247 | public function withoutHeader($header) |
| 248 | 248 | { |
| 249 | - if (! $this->hasHeader($header)) { |
|
| 249 | + if (!$this->hasHeader($header)) { |
|
| 250 | 250 | return clone $this; |
| 251 | 251 | } |
| 252 | 252 | |
@@ -599,14 +599,14 @@ discard block |
||
| 599 | 599 | if (null === $method) { |
| 600 | 600 | return true; |
| 601 | 601 | } |
| 602 | - if (! is_string($method)) { |
|
| 602 | + if (!is_string($method)) { |
|
| 603 | 603 | throw new InvalidArgumentException(sprintf( |
| 604 | 604 | 'Unsupported HTTP method; must be a string, received %s', |
| 605 | 605 | (is_object($method) ? get_class($method) : gettype($method)) |
| 606 | 606 | )); |
| 607 | 607 | } |
| 608 | 608 | $method = strtoupper($method); |
| 609 | - if (! in_array($method, $this->validMethods, true)) { |
|
| 609 | + if (!in_array($method, $this->validMethods, true)) { |
|
| 610 | 610 | throw new InvalidArgumentException(sprintf( |
| 611 | 611 | 'Unsupported HTTP method "%s" provided', |
| 612 | 612 | $method |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | $value = array($value); |
| 164 | 164 | } |
| 165 | 165 | |
| 166 | - if (! is_array($value) || ! $this->arrayContainsOnlyStrings($value)) { |
|
| 166 | + if (!is_array($value) || !$this->arrayContainsOnlyStrings($value)) { |
|
| 167 | 167 | throw new InvalidArgumentException( |
| 168 | 168 | 'Invalid header value; must be a string or array of strings' |
| 169 | 169 | ); |
@@ -202,13 +202,13 @@ discard block |
||
| 202 | 202 | $value = array($value); |
| 203 | 203 | } |
| 204 | 204 | |
| 205 | - if (! is_array($value) || ! $this->arrayContainsOnlyStrings($value)) { |
|
| 205 | + if (!is_array($value) || !$this->arrayContainsOnlyStrings($value)) { |
|
| 206 | 206 | throw new InvalidArgumentException( |
| 207 | 207 | 'Invalid header value; must be a string or array of strings' |
| 208 | 208 | ); |
| 209 | 209 | } |
| 210 | 210 | |
| 211 | - if (! $this->hasHeader($header)) { |
|
| 211 | + if (!$this->hasHeader($header)) { |
|
| 212 | 212 | return $this->withHeader($header, $value); |
| 213 | 213 | } |
| 214 | 214 | |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | */ |
| 237 | 237 | public function withoutHeader($header) |
| 238 | 238 | { |
| 239 | - if (! $this->hasHeader($header)) { |
|
| 239 | + if (!$this->hasHeader($header)) { |
|
| 240 | 240 | return clone $this; |
| 241 | 241 | } |
| 242 | 242 | |
@@ -257,7 +257,7 @@ discard block |
||
| 257 | 257 | */ |
| 258 | 258 | public function setBody($body = 'php://memory') |
| 259 | 259 | { |
| 260 | - if (! is_string($body) && ! is_resource($body) && ! $body instanceof StreamInterface) { |
|
| 260 | + if (!is_string($body) && !is_resource($body) && !$body instanceof StreamInterface) { |
|
| 261 | 261 | throw new InvalidArgumentException( |
| 262 | 262 | 'Stream must be a string stream resource identifier, ' |
| 263 | 263 | . 'an actual stream resource, ' |
@@ -499,15 +499,15 @@ discard block |
||
| 499 | 499 | { |
| 500 | 500 | $headerNames = $headers = array(); |
| 501 | 501 | foreach ($originalHeaders as $header => $value) { |
| 502 | - if (! is_string($header)) { |
|
| 502 | + if (!is_string($header)) { |
|
| 503 | 503 | continue; |
| 504 | 504 | } |
| 505 | 505 | |
| 506 | - if (! is_array($value) && ! is_string($value)) { |
|
| 506 | + if (!is_array($value) && !is_string($value)) { |
|
| 507 | 507 | continue; |
| 508 | 508 | } |
| 509 | 509 | |
| 510 | - if (! is_array($value)) { |
|
| 510 | + if (!is_array($value)) { |
|
| 511 | 511 | $value = array($value); |
| 512 | 512 | } |
| 513 | 513 | |
@@ -542,7 +542,7 @@ discard block |
||
| 542 | 542 | */ |
| 543 | 543 | private function validateStatus($code) |
| 544 | 544 | { |
| 545 | - if (! is_numeric($code) |
|
| 545 | + if (!is_numeric($code) |
|
| 546 | 546 | || is_float($code) |
| 547 | 547 | || $code < 100 |
| 548 | 548 | || $code >= 600 |