Passed
Push — master ( e25047...d6dcc5 )
by Fran
04:44
created
src/base/types/interfaces/ControllerInterface.php 1 patch
Doc Comments   +6 added lines patch added patch discarded remove patch
@@ -8,7 +8,13 @@
 block discarded – undo
8 8
  */
9 9
 interface ControllerInterface
10 10
 {
11
+    /**
12
+     * @return string|null
13
+     */
11 14
     public function render($template, array $vars = [], $cookies = []);
12 15
 
16
+    /**
17
+     * @return void
18
+     */
13 19
     public function response($response, $type = 'text/html');
14 20
 }
Please login to merge, or discard this patch.
src/services/AdminServices.php 3 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -4,7 +4,6 @@
 block discarded – undo
4 4
 use PSFS\base\config\Config;
5 5
 use PSFS\base\Security;
6 6
 use PSFS\base\Service;
7
-use PSFS\controller\Admin;
8 7
 use Symfony\Component\Finder\Finder;
9 8
 
10 9
 class AdminServices extends Service
Please login to merge, or discard this patch.
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -61,11 +61,13 @@  discard block
 block discarded – undo
61 61
      */
62 62
     private function parseAdmins(&$admins)
63 63
     {
64
-        if (!empty($admins)) foreach ($admins as &$admin) {
64
+        if (!empty($admins)) {
65
+            foreach ($admins as &$admin) {
65 66
             if (isset($admin["profile"])) {
66 67
                 switch ($admin["profile"]) {
67 68
                     case Security::MANAGER_ID_TOKEN:
68 69
                         $admin['class'] = 'warning';
70
+        }
69 71
                         break;
70 72
                     case Security::ADMIN_ID_TOKEN:
71 73
                         $admin['class'] = 'info';
@@ -95,7 +97,9 @@  discard block
 block discarded – undo
95 97
             $size = $file->getSize() / 8 / 1024;
96 98
             $time = date("c", $file->getMTime());
97 99
             $dateTime = new \DateTime($time);
98
-            if (!isset($logs[$dateTime->format("Y")])) $logs[$dateTime->format("Y")] = array();
100
+            if (!isset($logs[$dateTime->format("Y")])) {
101
+                $logs[$dateTime->format("Y")] = array();
102
+            }
99 103
             $logs[$dateTime->format("Y")][$dateTime->format("m")][$time] = array(
100 104
                 "filename" => $file->getFilename(),
101 105
                 "size" => round($size, 3)
@@ -136,7 +140,9 @@  discard block
 block discarded – undo
136 140
                 $detailLog[] = array_merge(array(
137 141
                     "log" => $line,
138 142
                 ), $detail);
139
-                if (count($detailLog) >= 1000) break;
143
+                if (count($detailLog) >= 1000) {
144
+                    break;
145
+                }
140 146
             }
141 147
             $log = $detailLog;
142 148
         }
@@ -160,7 +166,9 @@  discard block
 block discarded – undo
160 166
 
161 167
                 $detail = json_decode($match[0][0], TRUE);
162 168
             }
163
-            if (empty($detail)) $detail = array();
169
+            if (empty($detail)) {
170
+                $detail = array();
171
+            }
164 172
             preg_match_all('/\>\ (.*):/i', $line, $match);
165 173
 
166 174
             $type = (isset($match[1][0])) ? $match[1][0] : '';
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
     {
35 35
         $platform = trim(Config::getInstance()->get("platform.name"));
36 36
         header('HTTP/1.1 401 Unauthorized');
37
-        header('WWW-Authenticate: Basic Realm="' . $platform . '"');
37
+        header('WWW-Authenticate: Basic Realm="'.$platform.'"');
38 38
         echo _("Zona restringida");
39 39
         exit();
40 40
     }
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
                         $admin['class'] = 'primary';
76 76
                         break;
77 77
                 }
78
-            } else {
78
+            }else {
79 79
                 $admin["class"] = "primary";
80 80
             }
81 81
         }
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
         $logs = array();
93 93
         /** @var \SplFileInfo $file */
94 94
         foreach ($files as $file) {
95
-            $size = $file->getSize() / 8 / 1024;
95
+            $size = $file->getSize()/8/1024;
96 96
             $time = date("c", $file->getMTime());
97 97
             $dateTime = new \DateTime($time);
98 98
             if (!isset($logs[$dateTime->format("Y")])) $logs[$dateTime->format("Y")] = array();
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
             $time = date("c", $file->getMTime());
129 129
             $dateTime = new \DateTime($time);
130 130
             $monthOpen = $dateTime->format("m");
131
-            $content = file($file->getPath() . DIRECTORY_SEPARATOR . $file->getFilename());
131
+            $content = file($file->getPath().DIRECTORY_SEPARATOR.$file->getFilename());
132 132
             krsort($content);
133 133
             $detailLog = array();
134 134
             foreach ($content as &$line) {
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
                     break;
182 182
             }
183 183
 
184
-        } catch (\Exception $e) {
184
+        }catch (\Exception $e) {
185 185
             $detail = array(
186 186
                 "type" => "danger",
187 187
             );
Please login to merge, or discard this patch.
src/base/config/LoginForm.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@
 block discarded – undo
37 37
             ))
38 38
             ->addButton('submit', _("Acceder como {{username}}"))
39 39
             ->addButton("cancel", _("Cancelar"), "button", array(
40
-                "onclick" => "javacript:location.href = \"" . Router::getInstance()->getRoute('') . "\";",
40
+                "onclick" => "javacript:location.href = \"".Router::getInstance()->getRoute('')."\";",
41 41
                 "class" => "btn-link",
42 42
             ));
43 43
     }
Please login to merge, or discard this patch.
src/base/dto/Order.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@
 block discarded – undo
62 62
     {
63 63
         if (preg_match('/^asc$/i', $direction)) {
64 64
             return Order::ASC;
65
-        } else {
65
+        }else {
66 66
             return Order::DESC;
67 67
         }
68 68
     }
Please login to merge, or discard this patch.
src/base/types/AuthApi.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -26,13 +26,13 @@
 block discarded – undo
26 26
     {
27 27
         $namespace = explode('\\', $this->getModelTableMap());
28 28
         $module = strtolower($namespace[0]);
29
-        $secret = Config::getInstance()->get($module . '.api.secret');
29
+        $secret = Config::getInstance()->get($module.'.api.secret');
30 30
         if (NULL === $secret) {
31 31
             $secret = Config::getInstance()->get("api.secret");
32 32
         }
33 33
         if (NULL === $secret) {
34 34
             $auth = TRUE;
35
-        } else {
35
+        }else {
36 36
             $token = Request::getInstance()->getHeader('X-API-SEC-TOKEN');
37 37
             if (array_key_exists('API_TOKEN', $this->query)) {
38 38
                 $token = $this->query['API_TOKEN'];
Please login to merge, or discard this patch.
src/base/extension/AssetsNode.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -30,16 +30,16 @@
 block discarded – undo
30 30
         $scripts = $this->getNode("scripts");
31 31
 
32 32
         //Creamos el parser
33
-        $compiler->addDebugInfo($scripts)->write('$parser = new \\PSFS\\base\\extension\\AssetsParser(\'' . $this->type . '\')')
33
+        $compiler->addDebugInfo($scripts)->write('$parser = new \\PSFS\\base\\extension\\AssetsParser(\''.$this->type.'\')')
34 34
             ->raw(";\n");
35 35
 
36 36
         //Asociamos el hash
37
-        $compiler->write('$parser->setHash(\'' . $this->hash . '\')')
37
+        $compiler->write('$parser->setHash(\''.$this->hash.'\')')
38 38
             ->raw(";\n");
39 39
 
40 40
         //Asociamos los ficheros
41 41
         foreach ($scripts->getAttribute("value") as $value) {
42
-            $compiler->write('$parser->addFile(\'' . $value . '\')')->raw(";\n");
42
+            $compiler->write('$parser->addFile(\''.$value.'\')')->raw(";\n");
43 43
         }
44 44
 
45 45
         //Procesamos los ficheros
Please login to merge, or discard this patch.
src/base/extension/AssetsTokenParser.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -139,7 +139,7 @@
 block discarded – undo
139 139
         $tmp = array();
140 140
         if (NULL === $node) {
141 141
             $node = $value;
142
-        } else {
142
+        }else {
143 143
             $tmp = $this->getTmpAttribute($node);
144 144
         }
145 145
         $tmp[] = $value->getAttribute("value");
Please login to merge, or discard this patch.
src/base/Service.php 2 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
     /**
117 117
      * Add request param
118 118
      *
119
-     * @param $key
119
+     * @param integer $key
120 120
      * @param null $value
121 121
      *
122 122
      * @return \PSFS\base\Service
@@ -153,8 +153,8 @@  discard block
 block discarded – undo
153 153
     }
154 154
 
155 155
     /**
156
-     * @param $header
157
-     * @param null $content
156
+     * @param string $header
157
+     * @param string $content
158 158
      *
159 159
      * @return $this
160 160
      */
Please login to merge, or discard this patch.
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
     protected $isMultipart = false;
70 70
 
71 71
     private function closeConnection() {
72
-        if(null !== $this->con) {
72
+        if (null !== $this->con) {
73 73
             curl_close($this->con);
74 74
         }
75 75
     }
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
      */
233 233
     public function setIsJson($isJson = true) {
234 234
         $this->isJson = $isJson;
235
-        if($isJson) {
235
+        if ($isJson) {
236 236
             $this->setIsMultipart(false);
237 237
         }
238 238
     }
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
      */
250 250
     public function setIsMultipart($isMultipart = true) {
251 251
         $this->isMultipart = $isMultipart;
252
-        if($isMultipart) {
252
+        if ($isMultipart) {
253 253
             $this->setIsJson(false);
254 254
         }
255 255
     }
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
         $this->url = NULL;
270 270
         $this->params = array();
271 271
         $this->headers = array();
272
-        Logger::log('Context service for ' . static::class . ' cleared!');
272
+        Logger::log('Context service for '.static::class.' cleared!');
273 273
         $this->closeConnection();
274 274
     }
275 275
 
@@ -312,18 +312,18 @@  discard block
 block discarded – undo
312 312
     }
313 313
 
314 314
     protected function applyOptions() {
315
-        if(count($this->options)) {
315
+        if (count($this->options)) {
316 316
             curl_setopt_array($this->con, $this->options);
317 317
         }
318 318
     }
319 319
 
320 320
     protected function applyHeaders() {
321 321
         $headers = [];
322
-        foreach($this->headers as $key => $value) {
323
-            $headers[] = $key . ': ' . $value;
322
+        foreach ($this->headers as $key => $value) {
323
+            $headers[] = $key.': '.$value;
324 324
         }
325 325
         $headers[self::PSFS_TRACK_HEADER] = Logger::getUid();
326
-        if(count($headers)) {
326
+        if (count($headers)) {
327 327
             curl_setopt($this->con, CURLOPT_HTTPHEADER, $headers);
328 328
         }
329 329
     }
@@ -334,18 +334,18 @@  discard block
 block discarded – undo
334 334
             case Request::VERB_GET:
335 335
             default:
336 336
                 $this->addOption(CURLOPT_CUSTOMREQUEST, Request::VERB_GET);
337
-                if(!empty($this->params)) {
337
+                if (!empty($this->params)) {
338 338
                     $sep = !preg_match('/\?/', $this->getUrl()) ? '?' : '';
339
-                    $this->url = $this->url . $sep . http_build_query($this->params);
339
+                    $this->url = $this->url.$sep.http_build_query($this->params);
340 340
                 }
341 341
                 break;
342 342
             case Request::VERB_POST:
343 343
                 $this->addOption(CURLOPT_CUSTOMREQUEST, Request::VERB_POST);
344
-                if($this->getIsJson()) {
344
+                if ($this->getIsJson()) {
345 345
                     $this->addOption(CURLOPT_POSTFIELDS, json_encode($this->params));
346
-                } elseif($this->getIsMultipart()) {
346
+                } elseif ($this->getIsMultipart()) {
347 347
                     $this->addOption(CURLOPT_POSTFIELDS, $this->params);
348
-                } else {
348
+                }else {
349 349
                     $this->addOption(CURLOPT_POSTFIELDS, http_build_query($this->params));
350 350
                 }
351 351
                 break;
@@ -355,21 +355,21 @@  discard block
 block discarded – undo
355 355
             case Request::VERB_PUT:
356 356
                 $this->addOption(CURLOPT_CUSTOMREQUEST, Request::VERB_PUT);
357 357
 
358
-                if($this->getIsJson()) {
358
+                if ($this->getIsJson()) {
359 359
                     $this->addOption(CURLOPT_POSTFIELDS, json_encode($this->params));
360
-                } elseif($this->getIsMultipart()) {
360
+                } elseif ($this->getIsMultipart()) {
361 361
                     $this->addOption(CURLOPT_POSTFIELDS, $this->params);
362
-                } else {
362
+                }else {
363 363
                     $this->addOption(CURLOPT_POSTFIELDS, http_build_query($this->params));
364 364
                 }
365 365
                 break;
366 366
             case Request::VERB_PATCH:
367 367
                 $this->addOption(CURLOPT_CUSTOMREQUEST, Request::VERB_PATCH);
368
-                if($this->getIsJson()) {
368
+                if ($this->getIsJson()) {
369 369
                     $this->addOption(CURLOPT_POSTFIELDS, json_encode($this->params));
370
-                } elseif($this->getIsMultipart()) {
370
+                } elseif ($this->getIsMultipart()) {
371 371
                     $this->addOption(CURLOPT_POSTFIELDS, $this->params);
372
-                } else {
372
+                }else {
373 373
                     $this->addOption(CURLOPT_POSTFIELDS, http_build_query($this->params));
374 374
                 }
375 375
                 break;
@@ -386,14 +386,14 @@  discard block
 block discarded – undo
386 386
         $this->setDefaults();
387 387
         $this->applyOptions();
388 388
         $this->applyHeaders();
389
-        if('debug' === Config::getParam('log.level')) {
389
+        if ('debug' === Config::getParam('log.level')) {
390 390
             curl_setopt($this->con, CURLOPT_VERBOSE, true);
391 391
             $verbose = fopen('php://temp', 'w+');
392 392
             curl_setopt($this->con, CURLOPT_STDERR, $verbose);
393 393
         }
394 394
         $result = curl_exec($this->con);
395 395
         $this->result = $this->isJson ? json_decode($result, true) : $result;
396
-        if('debug' === Config::getParam('log.level')) {
396
+        if ('debug' === Config::getParam('log.level')) {
397 397
             rewind($verbose);
398 398
             $verboseLog = stream_get_contents($verbose);
399 399
             Logger::log($verboseLog, LOG_DEBUG, [
@@ -403,7 +403,7 @@  discard block
 block discarded – undo
403 403
             ]);
404 404
             $this->info['verbose'] = $verboseLog;
405 405
         }
406
-        Logger::log($this->url . ' response: ', LOG_DEBUG, is_array($this->result) ? $this->result : [$this->result]);
406
+        Logger::log($this->url.' response: ', LOG_DEBUG, is_array($this->result) ? $this->result : [$this->result]);
407 407
         $this->info = array_merge($this->info, curl_getinfo($this->con));
408 408
     }
409 409
 
Please login to merge, or discard this patch.
src/base/types/helpers/AdminHelper.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
     {
32 32
         $routes = [];
33 33
         foreach ($systemRoutes as $route => $params) {
34
-            if(isset($params['http']) && 'GET' === $params['http'] && preg_match('/^\/admin(\/|$)/', $params['default'])) {
34
+            if (isset($params['http']) && 'GET' === $params['http'] && preg_match('/^\/admin(\/|$)/', $params['default'])) {
35 35
                 $module = strtoupper($params['module']);
36 36
                 $mode = $params["visible"] ? 'visible' : 'hidden';
37 37
                 $routes[$module][$mode][] = [
@@ -41,11 +41,11 @@  discard block
 block discarded – undo
41 41
                 ];
42 42
             }
43 43
         }
44
-        foreach($routes as $module => &$route) {
45
-            if(array_key_exists('visible', $route)) {
44
+        foreach ($routes as $module => &$route) {
45
+            if (array_key_exists('visible', $route)) {
46 46
                 uasort($route["visible"], '\PSFS\base\types\helpers\AdminHelper::sortByLabel');
47 47
             }
48
-            if(array_key_exists('hidden', $route)) {
48
+            if (array_key_exists('hidden', $route)) {
49 49
                 uasort($route["hidden"], '\PSFS\base\types\helpers\AdminHelper::sortByLabel');
50 50
             }
51 51
         }
Please login to merge, or discard this patch.