Completed
Push — master ( ee49f4...f8fced )
by Alejandro
02:23
created
src/Modules/Localize/Localize.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -62,6 +62,9 @@
 block discarded – undo
62 62
         $this->reloadConfig();
63 63
     }
64 64
 
65
+    /**
66
+     * @param string $locale
67
+     */
65 68
     public function setLocale($locale) {
66 69
         $this->locale = $locale;
67 70
         $folder = \Tight\Utils::addTrailingSlash($this->config->resourceFolder);
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
         $this->checkDependences();
45 45
         $this->setLocale($this->config->defaultLocale);
46 46
     }
47
-    public function getValues(){
47
+    public function getValues() {
48 48
         return $this->values;
49 49
     }
50 50
     public function reloadConfig() {
@@ -65,15 +65,15 @@  discard block
 block discarded – undo
65 65
     public function setLocale($locale) {
66 66
         $this->locale = $locale;
67 67
         $folder = \Tight\Utils::addTrailingSlash($this->config->resourceFolder);
68
-        $fileName = $this->config->resourceFileName . $this->config->langSeparator . $locale . "." . $this->config->resourceFileType;
69
-        $file = $folder . $fileName;
68
+        $fileName = $this->config->resourceFileName.$this->config->langSeparator.$locale.".".$this->config->resourceFileType;
69
+        $file = $folder.$fileName;
70 70
         if (is_file($file)) {
71 71
             echo $file;
72 72
         } else {
73
-            $fileName = $this->config->resourceFileName . "." . $this->config->resourceFileType;
74
-            $file = $folder . $fileName;
73
+            $fileName = $this->config->resourceFileName.".".$this->config->resourceFileType;
74
+            $file = $folder.$fileName;
75 75
             if (!is_file($file)) {
76
-                throw new \Tight\Modules\ModuleException("Resource file <strong>" . $file . "</strong> not found");
76
+                throw new \Tight\Modules\ModuleException("Resource file <strong>".$file."</strong> not found");
77 77
             }
78 78
         }
79 79
         $this->values = json_decode(file_get_contents($file));
Please login to merge, or discard this patch.
src/Route.php 1 patch
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -224,7 +224,7 @@
 block discarded – undo
224 224
      * registered for the route, each callable middleware is invoked in
225 225
      * the order specified.
226 226
      *
227
-     * @return bool
227
+     * @return string
228 228
      */
229 229
     public function dispatch() {
230 230
         $output = "";
Please login to merge, or discard this patch.
src/Tight.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -140,8 +140,8 @@  discard block
 block discarded – undo
140 140
                     <body>
141 141
                         <h1>Tight Framework Exception</h1>
142 142
 EXC;
143
-        $output .= "<p><strong>" . get_class($ex) . ": </strong>" . $ex->getMessage() . "</p>";
144
-        $output .= "<p class='padding-left'>in <strong>" . $lastTrace['file'] . "</strong> at line <strong>" . $lastTrace['line'] . "</strong></p>";
143
+        $output .= "<p><strong>".get_class($ex).": </strong>".$ex->getMessage()."</p>";
144
+        $output .= "<p class='padding-left'>in <strong>".$lastTrace['file']."</strong> at line <strong>".$lastTrace['line']."</strong></p>";
145 145
         $output .= "<br/>";
146 146
         $output .= "<p>Stack Trace:</p>";
147 147
         $trace = $ex->getTrace();
@@ -150,9 +150,9 @@  discard block
 block discarded – undo
150 150
             $class = isset($el["class"]) ? $el["class"] : "";
151 151
             $type = isset($el["type"]) ? $el["type"] : "";
152 152
             $func = isset($el["function"]) ? $el["function"] : "";
153
-            $file = isset($el["file"]) ? "at <strong>" . $el["file"] . "</strong>" : "";
154
-            $line = isset($el["line"]) ? " at line <strong>" . $el["line"] . "</strong>" : "";
155
-            $output .= "<p>#" . ($index + 1) . ": " . $class . $type . $func . "() " . $file . $line . "</strong></p>";
153
+            $file = isset($el["file"]) ? "at <strong>".$el["file"]."</strong>" : "";
154
+            $line = isset($el["line"]) ? " at line <strong>".$el["line"]."</strong>" : "";
155
+            $output .= "<p>#".($index + 1).": ".$class.$type.$func."() ".$file.$line."</strong></p>";
156 156
         }
157 157
         echo $output;
158 158
     }
Please login to merge, or discard this patch.
src/Router.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
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
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
      * @return string Request URN
247 247
      */
248 248
     public function getRequestUrn() {
249
-        $output = Utils::addTrailingSlash("/" . Utils::removeSubstring($_SERVER['REQUEST_URI'], $this->basePath));
249
+        $output = Utils::addTrailingSlash("/".Utils::removeSubstring($_SERVER['REQUEST_URI'], $this->basePath));
250 250
         return $output;
251 251
     }
252 252
 
@@ -264,22 +264,22 @@  discard block
 block discarded – undo
264 264
         $viewDir = $config->mvc["view_dir"];
265 265
         if (is_dir($controllerDir) && is_dir($modelDir) && is_dir($viewDir)) {
266 266
             if (strpos(strtolower($className), "controller") !== FALSE) {
267
-                if (is_file($controllerDir . $className . ".php")) {
268
-                    require_once $controllerDir . $className . ".php";
267
+                if (is_file($controllerDir.$className.".php")) {
268
+                    require_once $controllerDir.$className.".php";
269 269
                 } else {
270
-                    $fileNotFound = $controllerDir . $className . ".php";
270
+                    $fileNotFound = $controllerDir.$className.".php";
271 271
                 }
272 272
             } elseif (strpos(strtolower($className), "model") !== FALSE) {
273
-                if (is_file($modelDir . $className . ".php")) {
274
-                    require_once $modelDir . $className . ".php";
273
+                if (is_file($modelDir.$className.".php")) {
274
+                    require_once $modelDir.$className.".php";
275 275
                 } else {
276
-                    $fileNotFound = $modelDir . $className . ".php";
276
+                    $fileNotFound = $modelDir.$className.".php";
277 277
                 }
278 278
             } elseif (strpos(strtolower($className), "view") !== FALSE) {
279
-                if (is_file($viewDir . $className . ".php")) {
280
-                    require_once $viewDir . $className . ".php";
279
+                if (is_file($viewDir.$className.".php")) {
280
+                    require_once $viewDir.$className.".php";
281 281
                 } else {
282
-                    $fileNotFound = $viewDir . $className . ".php";
282
+                    $fileNotFound = $viewDir.$className.".php";
283 283
                 }
284 284
             }
285 285
         } else {
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
             $err = !is_dir($controllerDir) ? "Controller directory cant be found" : !is_dir($modelDir) ? "Model directory cant be found" : "View directory cant be found";
290 290
             throw new \Tight\Exception\FileNotFoundException($err);
291 291
         } else if ($fileNotFound) {
292
-            $err = "File <strong>" . $fileNotFound . "</strong> not found";
292
+            $err = "File <strong>".$fileNotFound."</strong> not found";
293 293
             throw new \Tight\Exception\FileNotFoundException($err);
294 294
         }
295 295
     }
@@ -316,9 +316,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
326 326
                 if (method_exists($controller, $method)) {
327 327
                     call_user_method_array($method, $controller, $args);
328 328
                 } else {
329
-                    throw new \Tight\Exception\FileNotFoundException("Method <strong>" . $method . "</strong> not defined for <strong>" . $contName . "</strong> class");
329
+                    throw new \Tight\Exception\FileNotFoundException("Method <strong>".$method."</strong> not defined for <strong>".$contName."</strong> class");
330 330
                 }
331 331
             }
332 332
             $controller->render();
Please login to merge, or discard this patch.
tests/RouterTest.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -46,13 +46,13 @@
 block discarded – undo
46 46
             return "Hello";
47 47
         });
48 48
         $this->router->get("/hello/:id", function($id) {
49
-            return "Hello " . $id;
49
+            return "Hello ".$id;
50 50
         });
51 51
         $this->router->post("/world/", function() {
52 52
             return "world";
53 53
         });
54 54
         $this->router->post("/world/:id", function($id) {
55
-            return $id . " world";
55
+            return $id." world";
56 56
         });
57 57
         $this->router->map(["get", "post"], "/map/", function() {
58 58
             return "map";
Please login to merge, or discard this patch.