Passed
Pull Request — master (#257)
by
unknown
02:39
created
src/Libraries/Module/ModuleManager.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
      * @param string $srcPath
221 221
      * @param string $dstPath
222 222
      */
223
-    private function processTemplates(string $srcPath, string &$dstPath){
223
+    private function processTemplates(string $srcPath, string &$dstPath) {
224 224
         $dstPath = str_replace('.tpl', '.php', $dstPath);
225 225
         $content = $this->fs->get($srcPath);
226 226
         $processedContent = $this->replacePlaceholders($content);
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
     private function replacePlaceholders(string $content): string
235 235
     {
236 236
         $placeholders = [
237
-            '{{MODULE_NAMESPACE}}' => $this->getBaseNamespace() .'\\' . $this->getModuleName(),
237
+            '{{MODULE_NAMESPACE}}' => $this->getBaseNamespace() . '\\' . $this->getModuleName(),
238 238
             '{{MODULE_NAME}}' => $this->getModuleName(),
239 239
         ];
240 240
 
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -207,8 +207,7 @@
 block discarded – undo
207 207
             } else {
208 208
                 if ($processTemplates) {
209 209
                     $this->processTemplates($srcPath, $dstPath);
210
-                }
211
-                else {
210
+                } else {
212 211
                     $this->fs->copy($srcPath, $dstPath);
213 212
                 }
214 213
                 $copiedFiles[] = $dstPath;
Please login to merge, or discard this patch.
src/Libraries/Database/Adapters/Idiorm/Statements/Result.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@
 block discarded – undo
30 30
      */
31 31
     public function get(): array
32 32
     {
33
-        return array_map(function ($element) {
33
+        return array_map(function($element) {
34 34
             $item = clone $this;
35 35
             $item->updateOrmModel($element);
36 36
             return $item;
Please login to merge, or discard this patch.
src/Model/ModelCollection.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -82,7 +82,7 @@
 block discarded – undo
82 82
     {
83 83
         $this->processModels();
84 84
 
85
-        $this->models = array_filter($this->models, function ($m) use ($model) {
85
+        $this->models = array_filter($this->models, function($m) use ($model) {
86 86
             return $m !== $model;
87 87
         });
88 88
 
Please login to merge, or discard this patch.
src/Model/QtModel.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -92,7 +92,7 @@
 block discarded – undo
92 92
      */
93 93
     public function get(): ModelCollection
94 94
     {
95
-        $models = array_map(function ($item) {
95
+        $models = array_map(function($item) {
96 96
             return wrapToModel($item, static::class);
97 97
         }, $this->ormInstance->get());
98 98
 
Please login to merge, or discard this patch.
src/Paginator/Paginator.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
             ->offset($this->perPage * ($this->page - 1))
90 90
             ->get();
91 91
 
92
-            $models = array_map(function ($item) {
92
+            $models = array_map(function($item) {
93 93
                 return wrapToModel($item, $this->modelClass);
94 94
             }, $ormInstances);
95 95
 
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
      */
170 170
     public function lastPageNumber(): int
171 171
     {
172
-        return (int)ceil($this->total() / $this->perPage);
172
+        return (int) ceil($this->total() / $this->perPage);
173 173
     }
174 174
 
175 175
     /**
Please login to merge, or discard this patch.
src/Libraries/Auth/Adapters/JwtAuthAdapter.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -134,7 +134,7 @@
 block discarded – undo
134 134
     {
135 135
         $user = $this->authService->get('uuid', $uuid);
136 136
 
137
-        if($user) {
137
+        if ($user) {
138 138
             $this->setUpdatedTokens($user);
139 139
             return true;
140 140
         }
Please login to merge, or discard this patch.
src/Router/RouteController.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -36,8 +36,8 @@  discard block
 block discarded – undo
36 36
     protected static $currentRoute = null;
37 37
 
38 38
         /**
39
-     * @var bool
40
-     */
39
+         * @var bool
40
+         */
41 41
     public $csrfVerification = true;
42 42
 
43 43
     /**
@@ -75,12 +75,12 @@  discard block
 block discarded – undo
75 75
         return static::$routes;
76 76
     }
77 77
 
78
-      /**
79
-     * Handles the missing methods of the controller
80
-     * @param string $method
81
-     * @param array $arguments
82
-     * @throws ControllerException
83
-     */
78
+        /**
79
+         * Handles the missing methods of the controller
80
+         * @param string $method
81
+         * @param array $arguments
82
+         * @throws ControllerException
83
+         */
84 84
     public function __call(string $method, array $arguments)
85 85
     {
86 86
         throw ControllerException::undefinedMethod($method);
Please login to merge, or discard this patch.
src/Mvc/RouteDispatcher.php 2 patches
Indentation   +91 added lines, -91 removed lines patch added patch discarded remove patch
@@ -12,95 +12,95 @@
 block discarded – undo
12 12
  * @since 2.9.5
13 13
  */
14 14
 
15
- namespace Quantum\Mvc;
15
+    namespace Quantum\Mvc;
16 16
 
17
- use Quantum\Handlers\ViewCacheHandler;
18
- use Quantum\Http\Request;
19
- use Quantum\Http\Response;
20
- use Quantum\Middleware\MiddlewareExecutor;
21
- use Quantum\Libraries\Csrf\Csrf;
22
- use Quantum\Loader\Loader;
23
- use Quantum\Di\Di;
24
- use Quantum\Exceptions\ControllerException;
25
- use Quantum\Di\Exceptions\DiException;
26
- use ReflectionException;
27
- use Quantum\Router\RouteController;
28
- 
29
- class RouteDispatcher
30
- {
31
-     public static function handle(Request $request, Response $response): void
32
-     {
33
-         // 1. Apply middleware
34
-         [$request, $response] = (new MiddlewareExecutor())->execute($request, $response);
35
- 
36
-         // 2. Try serving from view cache
37
-         $viewCacheHandler = new ViewCacheHandler();
38
-         if ($viewCacheHandler->serveCachedView(route_uri(), $response)) {
39
-             return;
40
-         }
41
- 
42
-         // 3. Route callback or controller handling
43
-         $callback = route_callback();
44
- 
45
-         if ($callback) {
46
-             call_user_func_array($callback, self::getArgs($callback));
47
-         } else {
48
-             $controller = self::getController();
49
-             $action = self::getAction($controller);
50
- 
51
-             if ($controller->csrfVerification && in_array($request->getMethod(), Csrf::METHODS)) {
52
-                 csrf()->checkToken($request);
53
-             }
54
- 
55
-             if (method_exists($controller, '__before')) {
56
-                 call_user_func_array([$controller, '__before'], self::getArgs([$controller, '__before']));
57
-             }
58
- 
59
-             call_user_func_array([$controller, $action], self::getArgs([$controller, $action]));
60
- 
61
-             if (method_exists($controller, '__after')) {
62
-                 call_user_func_array([$controller, '__after'], self::getArgs([$controller, '__after']));
63
-             }
64
-         }
65
-     }
66
- 
67
-     private static function getController(): RouteController
68
-     {
69
-         $controllerPath = modules_dir() . DS . current_module() . DS . 'Controllers' . DS . current_controller() . '.php';
70
- 
71
-         $loader = Di::get(Loader::class);
72
- 
73
-         return $loader->loadClassFromFile(
74
-             $controllerPath,
75
-             function () {
76
-                 return ControllerException::controllerNotFound(current_controller());
77
-             },
78
-             function () {
79
-                 return ControllerException::controllerNotDefined(current_controller());
80
-             }
81
-         );
82
-     }
83
- 
84
-     private static function getAction(RouteController $controller): ?string
85
-     {
86
-         $action = current_action();
87
- 
88
-         if ($action && !method_exists($controller, $action)) {
89
-             throw ControllerException::actionNotDefined($action);
90
-         }
91
- 
92
-         return $action;
93
-     }
94
- 
95
-     private static function getArgs(callable $callable): array
96
-     {
97
-         return Di::autowire($callable, self::routeParams());
98
-     }
99
- 
100
-     private static function routeParams(): array
101
-     {
102
-         return array_map(function ($param) {
103
-             return $param['value'];
104
-         }, route_params());
105
-     }
106
- }
107 17
\ No newline at end of file
18
+    use Quantum\Handlers\ViewCacheHandler;
19
+    use Quantum\Http\Request;
20
+    use Quantum\Http\Response;
21
+    use Quantum\Middleware\MiddlewareExecutor;
22
+    use Quantum\Libraries\Csrf\Csrf;
23
+    use Quantum\Loader\Loader;
24
+    use Quantum\Di\Di;
25
+    use Quantum\Exceptions\ControllerException;
26
+    use Quantum\Di\Exceptions\DiException;
27
+    use ReflectionException;
28
+    use Quantum\Router\RouteController;
29
+ 
30
+    class RouteDispatcher
31
+    {
32
+        public static function handle(Request $request, Response $response): void
33
+        {
34
+            // 1. Apply middleware
35
+            [$request, $response] = (new MiddlewareExecutor())->execute($request, $response);
36
+ 
37
+            // 2. Try serving from view cache
38
+            $viewCacheHandler = new ViewCacheHandler();
39
+            if ($viewCacheHandler->serveCachedView(route_uri(), $response)) {
40
+                return;
41
+            }
42
+ 
43
+            // 3. Route callback or controller handling
44
+            $callback = route_callback();
45
+ 
46
+            if ($callback) {
47
+                call_user_func_array($callback, self::getArgs($callback));
48
+            } else {
49
+                $controller = self::getController();
50
+                $action = self::getAction($controller);
51
+ 
52
+                if ($controller->csrfVerification && in_array($request->getMethod(), Csrf::METHODS)) {
53
+                    csrf()->checkToken($request);
54
+                }
55
+ 
56
+                if (method_exists($controller, '__before')) {
57
+                    call_user_func_array([$controller, '__before'], self::getArgs([$controller, '__before']));
58
+                }
59
+ 
60
+                call_user_func_array([$controller, $action], self::getArgs([$controller, $action]));
61
+ 
62
+                if (method_exists($controller, '__after')) {
63
+                    call_user_func_array([$controller, '__after'], self::getArgs([$controller, '__after']));
64
+                }
65
+            }
66
+        }
67
+ 
68
+        private static function getController(): RouteController
69
+        {
70
+            $controllerPath = modules_dir() . DS . current_module() . DS . 'Controllers' . DS . current_controller() . '.php';
71
+ 
72
+            $loader = Di::get(Loader::class);
73
+ 
74
+            return $loader->loadClassFromFile(
75
+                $controllerPath,
76
+                function () {
77
+                    return ControllerException::controllerNotFound(current_controller());
78
+                },
79
+                function () {
80
+                    return ControllerException::controllerNotDefined(current_controller());
81
+                }
82
+            );
83
+        }
84
+ 
85
+        private static function getAction(RouteController $controller): ?string
86
+        {
87
+            $action = current_action();
88
+ 
89
+            if ($action && !method_exists($controller, $action)) {
90
+                throw ControllerException::actionNotDefined($action);
91
+            }
92
+ 
93
+            return $action;
94
+        }
95
+ 
96
+        private static function getArgs(callable $callable): array
97
+        {
98
+            return Di::autowire($callable, self::routeParams());
99
+        }
100
+ 
101
+        private static function routeParams(): array
102
+        {
103
+            return array_map(function ($param) {
104
+                return $param['value'];
105
+            }, route_params());
106
+        }
107
+    }
108 108
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -72,10 +72,10 @@  discard block
 block discarded – undo
72 72
  
73 73
          return $loader->loadClassFromFile(
74 74
              $controllerPath,
75
-             function () {
75
+             function() {
76 76
                  return ControllerException::controllerNotFound(current_controller());
77 77
              },
78
-             function () {
78
+             function() {
79 79
                  return ControllerException::controllerNotDefined(current_controller());
80 80
              }
81 81
          );
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
  
100 100
      private static function routeParams(): array
101 101
      {
102
-         return array_map(function ($param) {
102
+         return array_map(function($param) {
103 103
              return $param['value'];
104 104
          }, route_params());
105 105
      }
Please login to merge, or discard this patch.