@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | if (null !== $basePath && is_string($basePath) && !empty($basePath)) { |
| 81 | 81 | $basePath = Utils::filterPath($basePath); |
| 82 | 82 | if (Utils::inString($basePath, $_SERVER['DOCUMENT_ROOT'])) { |
| 83 | - $this->basePath = Utils::removeDouble("/".Utils::removeSubstring($basePath, $_SERVER['DOCUMENT_ROOT']),"/"); |
|
| 83 | + $this->basePath = Utils::removeDouble("/".Utils::removeSubstring($basePath, $_SERVER['DOCUMENT_ROOT']), "/"); |
|
| 84 | 84 | } else { |
| 85 | 85 | $this->basePath = $basePath; |
| 86 | 86 | } |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | } |
| 172 | 172 | $pattern = array_shift($args); // 1st index-> Pattern |
| 173 | 173 | $callable = array_pop($args); // Last index-> callable |
| 174 | - $route = new Route(Utils::removeDouble($this->basePath . $pattern, "/"), $callable); |
|
| 174 | + $route = new Route(Utils::removeDouble($this->basePath.$pattern, "/"), $callable); |
|
| 175 | 175 | $route->setHttpMethods($methods); |
| 176 | 176 | if (count($args) > 0) { |
| 177 | 177 | // Adds the middleware |
@@ -247,7 +247,7 @@ discard block |
||
| 247 | 247 | * @return string Request URN |
| 248 | 248 | */ |
| 249 | 249 | public function getRequestUrn() { |
| 250 | - $output = Utils::addTrailingSlash("/" . Utils::removeSubstring($_SERVER['REQUEST_URI'], $this->basePath)); |
|
| 250 | + $output = Utils::addTrailingSlash("/".Utils::removeSubstring($_SERVER['REQUEST_URI'], $this->basePath)); |
|
| 251 | 251 | return $output; |
| 252 | 252 | } |
| 253 | 253 | |
@@ -265,22 +265,22 @@ discard block |
||
| 265 | 265 | $viewDir = $config->mvc["view_dir"]; |
| 266 | 266 | if (is_dir($controllerDir) && is_dir($modelDir) && is_dir($viewDir)) { |
| 267 | 267 | if (strpos(strtolower($className), "controller") !== FALSE) { |
| 268 | - if (is_file($controllerDir . $className . ".php")) { |
|
| 269 | - require_once $controllerDir . $className . ".php"; |
|
| 268 | + if (is_file($controllerDir.$className.".php")) { |
|
| 269 | + require_once $controllerDir.$className.".php"; |
|
| 270 | 270 | } else { |
| 271 | - $fileNotFound = $controllerDir . $className . ".php"; |
|
| 271 | + $fileNotFound = $controllerDir.$className.".php"; |
|
| 272 | 272 | } |
| 273 | 273 | } elseif (strpos(strtolower($className), "model") !== FALSE) { |
| 274 | - if (is_file($modelDir . $className . ".php")) { |
|
| 275 | - require_once $modelDir . $className . ".php"; |
|
| 274 | + if (is_file($modelDir.$className.".php")) { |
|
| 275 | + require_once $modelDir.$className.".php"; |
|
| 276 | 276 | } else { |
| 277 | - $fileNotFound = $modelDir . $className . ".php"; |
|
| 277 | + $fileNotFound = $modelDir.$className.".php"; |
|
| 278 | 278 | } |
| 279 | 279 | } elseif (strpos(strtolower($className), "view") !== FALSE) { |
| 280 | - if (is_file($viewDir . $className . ".php")) { |
|
| 281 | - require_once $viewDir . $className . ".php"; |
|
| 280 | + if (is_file($viewDir.$className.".php")) { |
|
| 281 | + require_once $viewDir.$className.".php"; |
|
| 282 | 282 | } else { |
| 283 | - $fileNotFound = $viewDir . $className . ".php"; |
|
| 283 | + $fileNotFound = $viewDir.$className.".php"; |
|
| 284 | 284 | } |
| 285 | 285 | } |
| 286 | 286 | } else { |
@@ -290,7 +290,7 @@ discard block |
||
| 290 | 290 | $err = !is_dir($controllerDir) ? "Controller directory not found" : (!is_dir($modelDir) ? "Model directory not found" : "View directory not found"); |
| 291 | 291 | throw new \Tight\Exception\RouterException($err); |
| 292 | 292 | } else if ($fileNotFound !== false) { |
| 293 | - $err = "File <strong>" . $fileNotFound . "</strong> not found"; |
|
| 293 | + $err = "File <strong>".$fileNotFound."</strong> not found"; |
|
| 294 | 294 | throw new \Tight\Exception\NotFoundException($err); |
| 295 | 295 | } |
| 296 | 296 | } |
@@ -316,9 +316,9 @@ discard block |
||
| 316 | 316 | } |
| 317 | 317 | } |
| 318 | 318 | $name = ucwords($name); |
| 319 | - $contName = $name . "Controller"; |
|
| 320 | - $viewName = $name . "View"; |
|
| 321 | - $modName = $name . "Model"; |
|
| 319 | + $contName = $name."Controller"; |
|
| 320 | + $viewName = $name."View"; |
|
| 321 | + $modName = $name."Model"; |
|
| 322 | 322 | $model = new $modName(); |
| 323 | 323 | $view = new $viewName(); |
| 324 | 324 | $controller = new $contName($model, $view); |
@@ -326,7 +326,7 @@ discard block |
||
| 326 | 326 | if (method_exists($controller, $method)) { |
| 327 | 327 | call_user_method_array($method, $controller, $args); |
| 328 | 328 | } else { |
| 329 | - throw new \Tight\Exception\RouterException("Method <strong>" . $method . "</strong> not defined for <strong>" . $contName . "</strong> class"); |
|
| 329 | + throw new \Tight\Exception\RouterException("Method <strong>".$method."</strong> not defined for <strong>".$contName."</strong> class"); |
|
| 330 | 330 | } |
| 331 | 331 | } |
| 332 | 332 | $controller->render(); |