@@ -29,11 +29,13 @@ discard block |
||
| 29 | 29 | */ |
| 30 | 30 | public static function create($module, Array $module_settings = []) |
| 31 | 31 | { |
| 32 | - if (empty($module)) |
|
| 33 | - throw new \RuntimeException("The module name must be specified"); |
|
| 32 | + if (empty($module)) { |
|
| 33 | + throw new \RuntimeException("The module name must be specified"); |
|
| 34 | + } |
|
| 34 | 35 | |
| 35 | - if (!is_string($module)) |
|
| 36 | - throw new \InvalidArgumentException("Invalid type given. string expected"); |
|
| 36 | + if (!is_string($module)) { |
|
| 37 | + throw new \InvalidArgumentException("Invalid type given. string expected"); |
|
| 38 | + } |
|
| 37 | 39 | |
| 38 | 40 | /* |
| 39 | 41 | * Module class instantiation |
@@ -44,13 +46,15 @@ discard block |
||
| 44 | 46 | */ |
| 45 | 47 | $fqn_module = "\\" . $module . "\\Module"; |
| 46 | 48 | |
| 47 | - if (!class_exists($fqn_module)) |
|
| 48 | - throw new Exception\ModuleNotFoundException("The module class '$fqn_module' does not exists!"); |
|
| 49 | + if (!class_exists($fqn_module)) { |
|
| 50 | + throw new Exception\ModuleNotFoundException("The module class '$fqn_module' does not exists!"); |
|
| 51 | + } |
|
| 49 | 52 | |
| 50 | 53 | $module = new $fqn_module($module); |
| 51 | 54 | |
| 52 | - if (array_key_exists('config', $module_settings) && !is_null($module_settings["config"])) |
|
| 53 | - $module->setConfigFile($module_settings["config"]); |
|
| 55 | + if (array_key_exists('config', $module_settings) && !is_null($module_settings["config"])) { |
|
| 56 | + $module->setConfigFile($module_settings["config"]); |
|
| 57 | + } |
|
| 54 | 58 | |
| 55 | 59 | return $module; |
| 56 | 60 | } |
@@ -100,13 +100,15 @@ discard block |
||
| 100 | 100 | { |
| 101 | 101 | $_view = $this->path . DIRECTORY_SEPARATOR . $this->name . '.phtml'; |
| 102 | 102 | |
| 103 | - if (!file_exists($_view)) |
|
| 104 | - throw new Exception\ViewNotFoundException("The view '" .$this->name. "' does not exists"); |
|
| 103 | + if (!file_exists($_view)) { |
|
| 104 | + throw new Exception\ViewNotFoundException("The view '" .$this->name. "' does not exists"); |
|
| 105 | + } |
|
| 105 | 106 | |
| 106 | 107 | $contents = file_get_contents($_view); |
| 107 | 108 | |
| 108 | - if ($contents === false) |
|
| 109 | - throw new Exception\ViewGetContentsErrorException("The view '" .$this->name. "' does not exists"); |
|
| 109 | + if ($contents === false) { |
|
| 110 | + throw new Exception\ViewGetContentsErrorException("The view '" .$this->name. "' does not exists"); |
|
| 111 | + } |
|
| 110 | 112 | |
| 111 | 113 | return $contents; |
| 112 | 114 | } |
@@ -118,8 +120,9 @@ discard block |
||
| 118 | 120 | */ |
| 119 | 121 | public function render() |
| 120 | 122 | { |
| 121 | - if (count($this->getParams())) |
|
| 122 | - extract($this->getParams(), EXTR_SKIP); |
|
| 123 | + if (count($this->getParams())) { |
|
| 124 | + extract($this->getParams(), EXTR_SKIP); |
|
| 125 | + } |
|
| 123 | 126 | |
| 124 | 127 | include $this->getContents(); |
| 125 | 128 | } |
@@ -100,8 +100,9 @@ discard block |
||
| 100 | 100 | */ |
| 101 | 101 | public function getController() |
| 102 | 102 | { |
| 103 | - if (is_null($this->controller)) |
|
| 104 | - throw new \RuntimeException("No controller matched, try to match first."); |
|
| 103 | + if (is_null($this->controller)) { |
|
| 104 | + throw new \RuntimeException("No controller matched, try to match first."); |
|
| 105 | + } |
|
| 105 | 106 | |
| 106 | 107 | return $this->controller; |
| 107 | 108 | } |
@@ -141,8 +142,9 @@ discard block |
||
| 141 | 142 | |
| 142 | 143 | foreach ($identifiers as $key => $identifier) |
| 143 | 144 | { |
| 144 | - if (!is_string($identifier)) |
|
| 145 | - throw new \InvalidArgumentException("Invalid type given for '$key'. String expected."); |
|
| 145 | + if (!is_string($identifier)) { |
|
| 146 | + throw new \InvalidArgumentException("Invalid type given for '$key'. String expected."); |
|
| 147 | + } |
|
| 146 | 148 | } |
| 147 | 149 | |
| 148 | 150 | $this->identifiers = [ |
@@ -167,8 +169,9 @@ discard block |
||
| 167 | 169 | |
| 168 | 170 | foreach ($identifiers as $key => $identifier) |
| 169 | 171 | { |
| 170 | - if (!is_string($identifier)) |
|
| 171 | - throw new \InvalidArgumentException("Invalid type given for '$key'. String expected."); |
|
| 172 | + if (!is_string($identifier)) { |
|
| 173 | + throw new \InvalidArgumentException("Invalid type given for '$key'. String expected."); |
|
| 174 | + } |
|
| 172 | 175 | } |
| 173 | 176 | |
| 174 | 177 | $this->defaults = [ |
@@ -237,8 +240,9 @@ discard block |
||
| 237 | 240 | */ |
| 238 | 241 | public function match() |
| 239 | 242 | { |
| 240 | - if (!is_callable($this->classNameBuilder)) |
|
| 241 | - throw \LogicException("No class name builder found"); |
|
| 243 | + if (!is_callable($this->classNameBuilder)) { |
|
| 244 | + throw \LogicException("No class name builder found"); |
|
| 245 | + } |
|
| 242 | 246 | |
| 243 | 247 | /* |
| 244 | 248 | * Key value pairs builder: |
@@ -297,8 +301,9 @@ discard block |
||
| 297 | 301 | } |
| 298 | 302 | } |
| 299 | 303 | |
| 300 | - if (!$match) |
|
| 301 | - throw new Exception\RouteNotFoundException("The route has not been matched"); |
|
| 304 | + if (!$match) { |
|
| 305 | + throw new Exception\RouteNotFoundException("The route has not been matched"); |
|
| 306 | + } |
|
| 302 | 307 | |
| 303 | 308 | $fqn_controller = call_user_func($this->classNameBuilder, $module, $controller); |
| 304 | 309 | |
@@ -312,17 +317,16 @@ discard block |
||
| 312 | 317 | catch (Exception\MethodNotFoundException $e) |
| 313 | 318 | { |
| 314 | 319 | throw new Exception\PageNotFoundException($e->getMessage(), $e->getCode(), $e); |
| 315 | - } |
|
| 316 | - catch (Exception\PrivateMethodExecutionException $e) |
|
| 320 | + } catch (Exception\PrivateMethodExecutionException $e) |
|
| 317 | 321 | { |
| 318 | 322 | throw new Exception\PageNotFoundException($e->getMessage(), $e->getCode(), $e); |
| 319 | 323 | } |
| 320 | 324 | |
| 321 | 325 | # in controller terms, a view is a method |
| 322 | 326 | $this->controller->setMethod($view); |
| 327 | + } else { |
|
| 328 | + throw new Exception\ControllerNotFoundException("The control class '$fqn_controller' does not exists!"); |
|
| 323 | 329 | } |
| 324 | - else |
|
| 325 | - throw new Exception\ControllerNotFoundException("The control class '$fqn_controller' does not exists!"); |
|
| 326 | 330 | } |
| 327 | 331 | |
| 328 | 332 | /** |
@@ -348,8 +352,9 @@ discard block |
||
| 348 | 352 | { |
| 349 | 353 | $key = array_keys($route); |
| 350 | 354 | |
| 351 | - if (count($key) > 1) |
|
| 352 | - throw new \InvalidArgumentException("So many keys in a simple route"); |
|
| 355 | + if (count($key) > 1) { |
|
| 356 | + throw new \InvalidArgumentException("So many keys in a simple route"); |
|
| 357 | + } |
|
| 353 | 358 | |
| 354 | 359 | $key = array_shift($key); |
| 355 | 360 | |
@@ -357,15 +362,18 @@ discard block |
||
| 357 | 362 | |
| 358 | 363 | foreach ($identifiers as $identifier) |
| 359 | 364 | { |
| 360 | - if (!array_key_exists($identifier, $route[$key])) |
|
| 361 | - throw new \InvalidArgumentException("The identifier '$identifier' does not exists in the route"); |
|
| 365 | + if (!array_key_exists($identifier, $route[$key])) { |
|
| 366 | + throw new \InvalidArgumentException("The identifier '$identifier' does not exists in the route"); |
|
| 367 | + } |
|
| 362 | 368 | |
| 363 | - if (!is_string($route[$key][$identifier])) |
|
| 364 | - throw new \InvalidArgumentException("Invalid type given for '$identifier'. String expected."); |
|
| 369 | + if (!is_string($route[$key][$identifier])) { |
|
| 370 | + throw new \InvalidArgumentException("Invalid type given for '$identifier'. String expected."); |
|
| 371 | + } |
|
| 365 | 372 | } |
| 366 | 373 | |
| 367 | - if (array_key_exists($key, $this->routes)) |
|
| 368 | - throw new \LogicException("The key '$key' was already defined as a route"); |
|
| 374 | + if (array_key_exists($key, $this->routes)) { |
|
| 375 | + throw new \LogicException("The key '$key' was already defined as a route"); |
|
| 376 | + } |
|
| 369 | 377 | |
| 370 | 378 | $this->routes = array_merge($this->routes, $route); |
| 371 | 379 | } |
@@ -406,10 +414,11 @@ discard block |
||
| 406 | 414 | $i = 1; |
| 407 | 415 | foreach ($params as $item) |
| 408 | 416 | { |
| 409 | - if ($i % 2 != 0) |
|
| 410 | - $vars[] = $item; |
|
| 411 | - else |
|
| 412 | - $values[] = $item; |
|
| 417 | + if ($i % 2 != 0) { |
|
| 418 | + $vars[] = $item; |
|
| 419 | + } else { |
|
| 420 | + $values[] = $item; |
|
| 421 | + } |
|
| 413 | 422 | $i++; |
| 414 | 423 | } |
| 415 | 424 | |
@@ -419,10 +428,11 @@ discard block |
||
| 419 | 428 | |
| 420 | 429 | for ($i = 0; $i < $vars_count; $i++) |
| 421 | 430 | { |
| 422 | - if (array_key_exists($i, $values)) |
|
| 423 | - $result[$vars[$i]] = $values[$i]; |
|
| 424 | - else |
|
| 425 | - $result[$vars[$i]] = ''; |
|
| 431 | + if (array_key_exists($i, $values)) { |
|
| 432 | + $result[$vars[$i]] = $values[$i]; |
|
| 433 | + } else { |
|
| 434 | + $result[$vars[$i]] = ''; |
|
| 435 | + } |
|
| 426 | 436 | } |
| 427 | 437 | |
| 428 | 438 | return $result; |
@@ -86,13 +86,14 @@ discard block |
||
| 86 | 86 | { |
| 87 | 87 | $method = $this->method; |
| 88 | 88 | |
| 89 | - if (is_null($method)) |
|
| 90 | - # This error is thrown because of 'setMethod' method has not been executed |
|
| 89 | + if (is_null($method)) { |
|
| 90 | + # This error is thrown because of 'setMethod' method has not been executed |
|
| 91 | 91 | throw new \LogicException("No method has been setted to execute!"); |
| 92 | + } |
|
| 92 | 93 | |
| 93 | - if (!is_null($this->module) && !$this->module->executionIsAllowed()) |
|
| 94 | - throw new Exception\MethodExecutionNotAllowedException("Method execution is not allowed"); |
|
| 95 | - else |
|
| 94 | + if (!is_null($this->module) && !$this->module->executionIsAllowed()) { |
|
| 95 | + throw new Exception\MethodExecutionNotAllowedException("Method execution is not allowed"); |
|
| 96 | + } else |
|
| 96 | 97 | { |
| 97 | 98 | if (method_exists($this, $method)) |
| 98 | 99 | { |
@@ -100,12 +101,12 @@ discard block |
||
| 100 | 101 | |
| 101 | 102 | $reflection = new \ReflectionMethod($this, $method); |
| 102 | 103 | |
| 103 | - if (!$reflection->isPublic()) |
|
| 104 | - throw new Exception\PrivateMethodExecutionException("The method '$method' is not public in the control class '$class'"); |
|
| 104 | + if (!$reflection->isPublic()) { |
|
| 105 | + throw new Exception\PrivateMethodExecutionException("The method '$method' is not public in the control class '$class'"); |
|
| 106 | + } |
|
| 105 | 107 | |
| 106 | 108 | return $this->$method(); |
| 107 | - } |
|
| 108 | - else |
|
| 109 | + } else |
|
| 109 | 110 | { |
| 110 | 111 | $class = __CLASS__; |
| 111 | 112 | throw new Exception\MethodNotFoundException("The method '$method' doesn't exists in the control class '$class'"); |
@@ -130,8 +131,9 @@ discard block |
||
| 130 | 131 | */ |
| 131 | 132 | public function getPost() |
| 132 | 133 | { |
| 133 | - if ($_SERVER['REQUEST_METHOD'] == 'POST' && empty($_POST)) |
|
| 134 | - $_POST = json_decode(file_get_contents('php://input'), true); |
|
| 134 | + if ($_SERVER['REQUEST_METHOD'] == 'POST' && empty($_POST)) { |
|
| 135 | + $_POST = json_decode(file_get_contents('php://input'), true); |
|
| 136 | + } |
|
| 135 | 137 | |
| 136 | 138 | return (array) $_POST; |
| 137 | 139 | } |
@@ -145,8 +147,9 @@ discard block |
||
| 145 | 147 | */ |
| 146 | 148 | public function getJson() |
| 147 | 149 | { |
| 148 | - if ($_SERVER['REQUEST_METHOD'] != 'JSON') |
|
| 149 | - throw new \LogicException("Request method is not JSON"); |
|
| 150 | + if ($_SERVER['REQUEST_METHOD'] != 'JSON') { |
|
| 151 | + throw new \LogicException("Request method is not JSON"); |
|
| 152 | + } |
|
| 150 | 153 | |
| 151 | 154 | $input = file_get_contents('php://input'); |
| 152 | 155 | $array = explode("&", $input); |
@@ -170,8 +173,9 @@ discard block |
||
| 170 | 173 | public function isXmlHttpRequest() |
| 171 | 174 | { |
| 172 | 175 | # non standard (HTTP_X_REQUESTED_WITH is not a part of PHP) |
| 173 | - if (isset($_SERVER['HTTP_X_REQUESTED_WITH'])) |
|
| 174 | - return true; |
|
| 176 | + if (isset($_SERVER['HTTP_X_REQUESTED_WITH'])) { |
|
| 177 | + return true; |
|
| 178 | + } |
|
| 175 | 179 | return false; |
| 176 | 180 | } |
| 177 | 181 | |
@@ -182,8 +186,9 @@ discard block |
||
| 182 | 186 | */ |
| 183 | 187 | public function isPost() |
| 184 | 188 | { |
| 185 | - if ($_SERVER["REQUEST_METHOD"] == "POST") |
|
| 186 | - return true; |
|
| 189 | + if ($_SERVER["REQUEST_METHOD"] == "POST") { |
|
| 190 | + return true; |
|
| 191 | + } |
|
| 187 | 192 | return false; |
| 188 | 193 | } |
| 189 | 194 | |
@@ -194,8 +199,9 @@ discard block |
||
| 194 | 199 | */ |
| 195 | 200 | public function isGet() |
| 196 | 201 | { |
| 197 | - if ($_SERVER["REQUEST_METHOD"] == "GET") |
|
| 198 | - return true; |
|
| 202 | + if ($_SERVER["REQUEST_METHOD"] == "GET") { |
|
| 203 | + return true; |
|
| 204 | + } |
|
| 199 | 205 | return false; |
| 200 | 206 | } |
| 201 | 207 | } |
| 202 | 208 | \ No newline at end of file |
@@ -99,19 +99,23 @@ discard block |
||
| 99 | 99 | public function __construct(Array $config) |
| 100 | 100 | { |
| 101 | 101 | # start sessions |
| 102 | - if (!isset($_SESSION)) |
|
| 103 | - session_start(); |
|
| 102 | + if (!isset($_SESSION)) { |
|
| 103 | + session_start(); |
|
| 104 | + } |
|
| 104 | 105 | |
| 105 | - if (!array_key_exists('environment', $config)) |
|
| 106 | - throw new \InvalidArgumentException("The 'environment' key was not defined"); |
|
| 106 | + if (!array_key_exists('environment', $config)) { |
|
| 107 | + throw new \InvalidArgumentException("The 'environment' key was not defined"); |
|
| 108 | + } |
|
| 107 | 109 | |
| 108 | - if (!array_key_exists('dev_mode', $config['environment'])) |
|
| 109 | - throw new \InvalidArgumentException("The 'dev_mode' key was not defined"); |
|
| 110 | + if (!array_key_exists('dev_mode', $config['environment'])) { |
|
| 111 | + throw new \InvalidArgumentException("The 'dev_mode' key was not defined"); |
|
| 112 | + } |
|
| 110 | 113 | |
| 111 | 114 | $this->devMode = $config["environment"]["dev_mode"]; |
| 112 | 115 | |
| 113 | - if (!array_key_exists('modules', $config)) |
|
| 114 | - throw new \InvalidArgumentException("The 'modules' key was not defined"); |
|
| 116 | + if (!array_key_exists('modules', $config)) { |
|
| 117 | + throw new \InvalidArgumentException("The 'modules' key was not defined"); |
|
| 118 | + } |
|
| 115 | 119 | |
| 116 | 120 | $this->modules = $config["modules"]; |
| 117 | 121 | |
@@ -125,33 +129,36 @@ discard block |
||
| 125 | 129 | { |
| 126 | 130 | ini_set('display_errors', 1); |
| 127 | 131 | error_reporting(-1); |
| 128 | - } |
|
| 129 | - else |
|
| 132 | + } else |
|
| 130 | 133 | { |
| 131 | 134 | ini_set('display_errors', 0); |
| 132 | 135 | error_reporting(0); |
| 133 | 136 | } |
| 134 | 137 | |
| 135 | - if (!array_key_exists('router', $config)) |
|
| 136 | - throw new \InvalidArgumentException("The 'router' key was not defined"); |
|
| 138 | + if (!array_key_exists('router', $config)) { |
|
| 139 | + throw new \InvalidArgumentException("The 'router' key was not defined"); |
|
| 140 | + } |
|
| 137 | 141 | |
| 138 | - if (!array_key_exists('routes', $config["router"])) |
|
| 139 | - throw new \InvalidArgumentException("The 'routes' key was not defined"); |
|
| 142 | + if (!array_key_exists('routes', $config["router"])) { |
|
| 143 | + throw new \InvalidArgumentException("The 'routes' key was not defined"); |
|
| 144 | + } |
|
| 140 | 145 | |
| 141 | 146 | $this->router = new Router($config["router"]["routes"]); |
| 142 | 147 | |
| 143 | - if (!array_key_exists('base_path', $config['environment'])) |
|
| 144 | - throw new \InvalidArgumentException("The 'base_path' key was not defined"); |
|
| 148 | + if (!array_key_exists('base_path', $config['environment'])) { |
|
| 149 | + throw new \InvalidArgumentException("The 'base_path' key was not defined"); |
|
| 150 | + } |
|
| 145 | 151 | |
| 146 | 152 | $this->basePath = $config["environment"]["base_path"]; |
| 147 | 153 | |
| 148 | 154 | # load routes from config |
| 149 | 155 | foreach ($config["router"]["routes"] as $name => $route) |
| 150 | 156 | { |
| 151 | - if ($route instanceof \Zend\Router\Http\RouteInterface) |
|
| 152 | - $this->router->addZendRoute($name, $route); |
|
| 153 | - else |
|
| 154 | - $this->router->addRoute($route); |
|
| 157 | + if ($route instanceof \Zend\Router\Http\RouteInterface) { |
|
| 158 | + $this->router->addZendRoute($name, $route); |
|
| 159 | + } else { |
|
| 160 | + $this->router->addRoute($route); |
|
| 161 | + } |
|
| 155 | 162 | } |
| 156 | 163 | |
| 157 | 164 | # register autoloading functions for each module |
@@ -172,11 +179,13 @@ discard block |
||
| 172 | 179 | { |
| 173 | 180 | $module_config_file = require($this->modulePath . "/$module/config/module.config.php"); |
| 174 | 181 | |
| 175 | - if (!array_key_exists('router', $module_config_file)) |
|
| 176 | - throw new \RuntimeException("The 'router' key was not defined in the config file for module '$module'"); |
|
| 182 | + if (!array_key_exists('router', $module_config_file)) { |
|
| 183 | + throw new \RuntimeException("The 'router' key was not defined in the config file for module '$module'"); |
|
| 184 | + } |
|
| 177 | 185 | |
| 178 | - if (!array_key_exists('routes', $module_config_file["router"])) |
|
| 179 | - throw new \RuntimeException("The 'routes' key was not defined in the config file for module '$module'"); |
|
| 186 | + if (!array_key_exists('routes', $module_config_file["router"])) { |
|
| 187 | + throw new \RuntimeException("The 'routes' key was not defined in the config file for module '$module'"); |
|
| 188 | + } |
|
| 180 | 189 | |
| 181 | 190 | $this->getRouter()->addRoute($module_config_file["router"]["routes"]); |
| 182 | 191 | } |
@@ -202,8 +211,9 @@ discard block |
||
| 202 | 211 | $uri .= !empty($controller) ? '/' . $controller : ""; |
| 203 | 212 | $uri .= !empty($view) ? '/' . $view : ""; |
| 204 | 213 | |
| 205 | - if (empty($uri)) |
|
| 206 | - $uri = "/"; |
|
| 214 | + if (empty($uri)) { |
|
| 215 | + $uri = "/"; |
|
| 216 | + } |
|
| 207 | 217 | |
| 208 | 218 | $request->setUri($uri); |
| 209 | 219 | |
@@ -219,9 +229,9 @@ discard block |
||
| 219 | 229 | $view = $params["action"]; |
| 220 | 230 | |
| 221 | 231 | $this->router->setIdentifiers($module, $controller, $view); |
| 232 | + } else { |
|
| 233 | + $this->router->setIdentifiers($module, $controller, $view); |
|
| 222 | 234 | } |
| 223 | - else |
|
| 224 | - $this->router->setIdentifiers($module, $controller, $view); |
|
| 225 | 235 | |
| 226 | 236 | $this->router->match(); |
| 227 | 237 | |
@@ -240,8 +250,9 @@ discard block |
||
| 240 | 250 | { |
| 241 | 251 | $result->setPath($this->basePath . DIRECTORY_SEPARATOR . $this->modulePath . DIRECTORY_SEPARATOR . 'source/view'); |
| 242 | 252 | |
| 243 | - if (is_null($result->getName())) |
|
| 244 | - $result->setView($router->getController()->getMethod()); |
|
| 253 | + if (is_null($result->getName())) { |
|
| 254 | + $result->setView($router->getController()->getMethod()); |
|
| 255 | + } |
|
| 245 | 256 | |
| 246 | 257 | $result->render(); |
| 247 | 258 | } |
@@ -141,8 +141,9 @@ |
||
| 141 | 141 | { |
| 142 | 142 | $_file = $this->configFile; |
| 143 | 143 | |
| 144 | - if (!file_exists($_file)) |
|
| 145 | - throw new \RuntimeException("The config file '$_file' does not exists"); |
|
| 144 | + if (!file_exists($_file)) { |
|
| 145 | + throw new \RuntimeException("The config file '$_file' does not exists"); |
|
| 146 | + } |
|
| 146 | 147 | |
| 147 | 148 | return (array) include $this->configFile; |
| 148 | 149 | } |
@@ -41,7 +41,8 @@ |
||
| 41 | 41 | |
| 42 | 42 | $class = $path . implode(DIRECTORY_SEPARATOR, $nm) . ".php"; |
| 43 | 43 | |
| 44 | - if (file_exists($class)) |
|
| 45 | - include $class; |
|
| 44 | + if (file_exists($class)) { |
|
| 45 | + include $class; |
|
| 46 | + } |
|
| 46 | 47 | } |
| 47 | 48 | } |
| 48 | 49 | \ No newline at end of file |
@@ -68,12 +68,10 @@ discard block |
||
| 68 | 68 | |
| 69 | 69 | try { |
| 70 | 70 | $router->match(); |
| 71 | - } |
|
| 72 | - catch (\Exception $e) |
|
| 71 | + } catch (\Exception $e) |
|
| 73 | 72 | { |
| 74 | 73 | $errorObject = ($e instanceof RouteNotFoundException); |
| 75 | - } |
|
| 76 | - finally |
|
| 74 | + } finally |
|
| 77 | 75 | { |
| 78 | 76 | $this->assertTrue($errorObject, $e->getMessage()); |
| 79 | 77 | } |
@@ -181,12 +179,10 @@ discard block |
||
| 181 | 179 | |
| 182 | 180 | try { |
| 183 | 181 | $router->run(); |
| 184 | - } |
|
| 185 | - catch (\Exception $e) |
|
| 182 | + } catch (\Exception $e) |
|
| 186 | 183 | { |
| 187 | 184 | $errorObject = ($e instanceof MethodExecutionNotAllowedException); |
| 188 | - } |
|
| 189 | - finally |
|
| 185 | + } finally |
|
| 190 | 186 | { |
| 191 | 187 | $this->assertTrue($errorObject, $e->getMessage()); |
| 192 | 188 | } |