@@ -58,8 +58,9 @@ discard block |
||
| 58 | 58 | public function prepare() |
| 59 | 59 | { |
| 60 | 60 | # start sessions |
| 61 | - if (!isset($_SESSION)) |
|
| 62 | - session_start(); |
|
| 61 | + if (!isset($_SESSION)) { |
|
| 62 | + session_start(); |
|
| 63 | + } |
|
| 63 | 64 | } |
| 64 | 65 | |
| 65 | 66 | /** |
@@ -91,8 +92,7 @@ discard block |
||
| 91 | 92 | |
| 92 | 93 | // Best way to view all possible errors |
| 93 | 94 | error_reporting(-1); |
| 94 | - } |
|
| 95 | - else { |
|
| 95 | + } else { |
|
| 96 | 96 | ini_set('display_errors', 0); |
| 97 | 97 | error_reporting(-1); |
| 98 | 98 | } |
@@ -109,10 +109,11 @@ discard block |
||
| 109 | 109 | |
| 110 | 110 | foreach ($app_config_file["router"]["routes"] as $name => $route) |
| 111 | 111 | { |
| 112 | - if ($route instanceof \Zend\Router\Http\RouteInterface) |
|
| 113 | - $this->getRouter()->addZendRoute($name, $route); |
|
| 114 | - else |
|
| 115 | - $this->getRouter()->addRoute($route); |
|
| 112 | + if ($route instanceof \Zend\Router\Http\RouteInterface) { |
|
| 113 | + $this->getRouter()->addZendRoute($name, $route); |
|
| 114 | + } else { |
|
| 115 | + $this->getRouter()->addRoute($route); |
|
| 116 | + } |
|
| 116 | 117 | } |
| 117 | 118 | } |
| 118 | 119 | |
@@ -146,14 +147,15 @@ discard block |
||
| 146 | 147 | * This instruction include each module declared in application.config.php |
| 147 | 148 | * Each module has an autoloader to load its classes (controllers and models) |
| 148 | 149 | */ |
| 149 | - if (file_exists("module/".$module."/Module.php")) |
|
| 150 | - include("module/".$module."/Module.php"); |
|
| 150 | + if (file_exists("module/".$module."/Module.php")) { |
|
| 151 | + include("module/".$module."/Module.php"); |
|
| 152 | + } |
|
| 151 | 153 | |
| 152 | 154 | spl_autoload_register($module . "\Module::loader"); |
| 153 | 155 | } |
| 156 | + } else { |
|
| 157 | + throw new \RuntimeException("The application must have at least one module"); |
|
| 154 | 158 | } |
| 155 | - else |
|
| 156 | - throw new \RuntimeException("The application must have at least one module"); |
|
| 157 | 159 | } |
| 158 | 160 | |
| 159 | 161 | /** |
@@ -175,8 +177,9 @@ discard block |
||
| 175 | 177 | $uri .= !empty($controller) ? '/' . $controller : ""; |
| 176 | 178 | $uri .= !empty($view) ? '/' . $view : ""; |
| 177 | 179 | |
| 178 | - if (empty($uri)) |
|
| 179 | - $uri = "/"; |
|
| 180 | + if (empty($uri)) { |
|
| 181 | + $uri = "/"; |
|
| 182 | + } |
|
| 180 | 183 | |
| 181 | 184 | $request->setUri($uri); |
| 182 | 185 | |
@@ -191,9 +194,9 @@ discard block |
||
| 191 | 194 | $view = $params["action"]; |
| 192 | 195 | |
| 193 | 196 | $this->router->setIdentifiers($module, $controller, $view); |
| 197 | + } else { |
|
| 198 | + $this->router->setIdentifiers($module, $controller, $view); |
|
| 194 | 199 | } |
| 195 | - else |
|
| 196 | - $this->router->setIdentifiers($module, $controller, $view); |
|
| 197 | 200 | |
| 198 | 201 | $this->router->run(); |
| 199 | 202 | } |