@@ -180,11 +180,11 @@ |
||
| 180 | 180 | public function getContent(FlattenException $exception, $showAll = true) |
| 181 | 181 | { |
| 182 | 182 | switch ($exception->getStatusCode()) { |
| 183 | - case 404: |
|
| 184 | - $title = "The page you are looking for could not be found"; |
|
| 185 | - break; |
|
| 186 | - default: |
|
| 187 | - $title = "Oh noes, something's broken"; |
|
| 183 | + case 404: |
|
| 184 | + $title = "The page you are looking for could not be found"; |
|
| 185 | + break; |
|
| 186 | + default: |
|
| 187 | + $title = "Oh noes, something's broken"; |
|
| 188 | 188 | } |
| 189 | 189 | |
| 190 | 190 | $content = ''; |
@@ -254,34 +254,34 @@ |
||
| 254 | 254 | { |
| 255 | 255 | switch ($key = strtolower($key)) { |
| 256 | 256 | |
| 257 | - case 'ajax': |
|
| 258 | - if (!isset($this->isCache['ajax'])) { |
|
| 259 | - return $this->isCache['ajax'] = $this->getService('Request')->isXmlHttpRequest(); |
|
| 260 | - } |
|
| 261 | - |
|
| 262 | - return $this->isCache['ajax']; |
|
| 263 | - |
|
| 264 | - case 'put': |
|
| 265 | - case 'delete': |
|
| 266 | - case 'post': |
|
| 267 | - case 'patch': |
|
| 268 | - if (!isset($this->isCache['requestMethod'][$key])) { |
|
| 269 | - $this->isCache['requestMethod'][$key] = $this->getService('Request')->getMethod() === strtoupper($key); |
|
| 270 | - } |
|
| 271 | - |
|
| 272 | - return $this->isCache['requestMethod'][$key]; |
|
| 273 | - |
|
| 274 | - case 'ssl': |
|
| 275 | - case 'https': |
|
| 276 | - case 'secure': |
|
| 277 | - if (!isset($this->isCache['secure'])) { |
|
| 278 | - $this->isCache['secure'] = $this->getService('Request')->isSecure(); |
|
| 279 | - } |
|
| 280 | - |
|
| 281 | - return $this->isCache['secure']; |
|
| 282 | - |
|
| 283 | - default: |
|
| 284 | - throw new \InvalidArgumentException("Invalid 'is' key supplied: {$key}"); |
|
| 257 | + case 'ajax': |
|
| 258 | + if (!isset($this->isCache['ajax'])) { |
|
| 259 | + return $this->isCache['ajax'] = $this->getService('Request')->isXmlHttpRequest(); |
|
| 260 | + } |
|
| 261 | + |
|
| 262 | + return $this->isCache['ajax']; |
|
| 263 | + |
|
| 264 | + case 'put': |
|
| 265 | + case 'delete': |
|
| 266 | + case 'post': |
|
| 267 | + case 'patch': |
|
| 268 | + if (!isset($this->isCache['requestMethod'][$key])) { |
|
| 269 | + $this->isCache['requestMethod'][$key] = $this->getService('Request')->getMethod() === strtoupper($key); |
|
| 270 | + } |
|
| 271 | + |
|
| 272 | + return $this->isCache['requestMethod'][$key]; |
|
| 273 | + |
|
| 274 | + case 'ssl': |
|
| 275 | + case 'https': |
|
| 276 | + case 'secure': |
|
| 277 | + if (!isset($this->isCache['secure'])) { |
|
| 278 | + $this->isCache['secure'] = $this->getService('Request')->isSecure(); |
|
| 279 | + } |
|
| 280 | + |
|
| 281 | + return $this->isCache['secure']; |
|
| 282 | + |
|
| 283 | + default: |
|
| 284 | + throw new \InvalidArgumentException("Invalid 'is' key supplied: {$key}"); |
|
| 285 | 285 | |
| 286 | 286 | } |
| 287 | 287 | } |
@@ -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 |
@@ -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 | |