Passed
Push — master ( aae343...cfdf4c )
by Fran
02:56
created
src/base/types/helpers/ApiFormHelper.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -17,11 +17,11 @@
 block discarded – undo
17 17
     public static function checkApiActions($namespace, $domain, $api) {
18 18
         $actions = [];
19 19
         $reflector = new \ReflectionClass($namespace);
20
-        if(null !== $reflector) {
21
-            foreach($reflector->getMethods(\ReflectionMethod::IS_PUBLIC) as $apiAction) {
20
+        if (null !== $reflector) {
21
+            foreach ($reflector->getMethods(\ReflectionMethod::IS_PUBLIC) as $apiAction) {
22 22
                 $docComments = $apiAction->getDocComment();
23 23
                 $action = self::extractAction($docComments);
24
-                if(null !== $action) {
24
+                if (null !== $action) {
25 25
                     list($route, $info) = RouterHelper::extractRouteInfo($apiAction, $api, $domain);
26 26
                     list($method, $cleanRoute) = RouterHelper::extractHttpRoute($route);
27 27
                     $formAction = new FormAction();
Please login to merge, or discard this patch.
src/functions.php 2 patches
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -31,9 +31,10 @@
 block discarded – undo
31 31
     function getallheaders()
32 32
     {
33 33
         $headers = array();
34
-        foreach ($_SERVER as $h => $v)
35
-            if (preg_match('/HTTP_(.+)/', $h, $hp))
34
+        foreach ($_SERVER as $h => $v) {
35
+                    if (preg_match('/HTTP_(.+)/', $h, $hp))
36 36
                 $headers[$hp[1]] = $v;
37
+        }
37 38
         return $headers;
38 39
     }
39 40
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@
 block discarded – undo
46 46
     /* @var $file SplFileInfo */
47 47
     foreach ($finder as $file) {
48 48
         $path = $file->getRealPath();
49
-        if(!in_array($path, $loaded_files)) {
49
+        if (!in_array($path, $loaded_files)) {
50 50
             $loaded_files[] = $path;
51 51
             require_once($path);
52 52
         }
Please login to merge, or discard this patch.
src/base/types/traits/BoostrapTrait.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -7,4 +7,4 @@
 block discarded – undo
7 7
  */
8 8
 Trait BoostrapTrait {}
9 9
 
10
-require_once __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'bootstrap.php';
11 10
\ No newline at end of file
11
+require_once __DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'bootstrap.php';
12 12
\ No newline at end of file
Please login to merge, or discard this patch.
src/base/types/traits/SystemTrait.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
                 $use /= 1024;
36 36
                 break;
37 37
             case "MBytes":
38
-                $use /= (1024 * 1024);
38
+                $use /= (1024*1024);
39 39
                 break;
40 40
             case "Bytes":
41 41
             default:
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
     {
61 61
         Logger::log('Added handlers for errors');
62 62
         //Warning & Notice handler
63
-        set_error_handler(function ($errno, $errstr, $errfile, $errline) {
63
+        set_error_handler(function($errno, $errstr, $errfile, $errline) {
64 64
             Logger::log($errstr, LOG_CRIT, ['file' => $errfile, 'line' => $errline, 'errno' => $errno]);
65 65
             return true;
66 66
         }, E_ALL | E_STRICT);
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
         Logger::log('Initializing stats (mem + ts)');
75 75
         if (null !== $_SERVER && array_key_exists('REQUEST_TIME_FLOAT', $_SERVER)) {
76 76
             $this->ts = (float)$_SERVER['REQUEST_TIME_FLOAT'];
77
-        } else {
77
+        }else {
78 78
             $this->ts = Request::getInstance()->getTs();
79 79
         }
80 80
         $this->mem = memory_get_usage();
Please login to merge, or discard this patch.
src/base/types/traits/SingletonTrait.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@
 block discarded – undo
34 34
      */
35 35
     public static function dropInstance() {
36 36
         $class = get_called_class();
37
-        if(isset(self::$instance[$class])) {
37
+        if (isset(self::$instance[$class])) {
38 38
             self::$instance[$class] = null;
39 39
         }
40 40
     }
Please login to merge, or discard this patch.
src/base/Request.php 3 patches
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -212,7 +212,9 @@  discard block
 block discarded – undo
212 212
      */
213 213
     public function redirect($url = null)
214 214
     {
215
-        if (null === $url) $url = $this->getServer('HTTP_ORIGIN');
215
+        if (null === $url) {
216
+            $url = $this->getServer('HTTP_ORIGIN');
217
+        }
216 218
         ob_start();
217 219
         header('Location: ' . $url);
218 220
         ob_end_clean();
@@ -259,7 +261,9 @@  discard block
 block discarded – undo
259 261
         $host = $this->getServerName();
260 262
         $protocol = $protocol ? $this->getProtocol() : '';
261 263
         $url = '';
262
-        if (!empty($host) && !empty($protocol)) $url = $protocol . $host;
264
+        if (!empty($host) && !empty($protocol)) {
265
+            $url = $protocol . $host;
266
+        }
263 267
         if (!in_array($this->getServer('SERVER_PORT'), [80, 443])) {
264 268
             $url .= ':' . $this->getServer('SERVER_PORT');
265 269
         }
Please login to merge, or discard this patch.
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 
55 55
     /**
56 56
      * Método que verifica si existe una cabecera concreta
57
-     * @param $header
57
+     * @param string $header
58 58
      *
59 59
      * @return boolean
60 60
      */
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
      *
176 176
      * @param string $queryParams
177 177
      *
178
-     * @return mixed
178
+     * @return string
179 179
      */
180 180
     public function getQuery($queryParams)
181 181
     {
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
      */
113 113
     public static function header($name, $default = null)
114 114
     {
115
-        return self::getInstance()->getHeader($name,  $default);
115
+        return self::getInstance()->getHeader($name, $default);
116 116
     }
117 117
 
118 118
     /**
@@ -125,8 +125,8 @@  discard block
 block discarded – undo
125 125
         $header = null;
126 126
         if ($this->hasHeader($name)) {
127 127
             $header = $this->header[$name];
128
-        } else if(array_key_exists('h_' . strtolower($name), $this->query)) {
129
-            $header = $this->query['h_' . strtolower($name)];
128
+        }else if (array_key_exists('h_'.strtolower($name), $this->query)) {
129
+            $header = $this->query['h_'.strtolower($name)];
130 130
         }
131 131
         return $header ?: $default;
132 132
     }
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
     {
225 225
         if (null === $url) $url = $this->getServer('HTTP_ORIGIN');
226 226
         ob_start();
227
-        header('Location: ' . $url);
227
+        header('Location: '.$url);
228 228
         ob_end_clean();
229 229
         Security::getInstance()->updateSession();
230 230
         exit(_("Redireccionando..."));
@@ -269,9 +269,9 @@  discard block
 block discarded – undo
269 269
         $host = $this->getServerName();
270 270
         $protocol = $protocol ? $this->getProtocol() : '';
271 271
         $url = '';
272
-        if (!empty($host) && !empty($protocol)) $url = $protocol . $host;
272
+        if (!empty($host) && !empty($protocol)) $url = $protocol.$host;
273 273
         if (!in_array($this->getServer('SERVER_PORT'), [80, 443])) {
274
-            $url .= ':' . $this->getServer('SERVER_PORT');
274
+            $url .= ':'.$this->getServer('SERVER_PORT');
275 275
         }
276 276
         return $url;
277 277
     }
Please login to merge, or discard this patch.
src/Dispatcher.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -69,16 +69,16 @@
 block discarded – undo
69 69
                 if (!Request::getInstance()->isFile()) {
70 70
                     return $this->router->execute($this->actualUri);
71 71
                 }
72
-            } else {
72
+            }else {
73 73
                 return ConfigController::getInstance()->config();
74 74
             }
75
-        } catch (AdminCredentialsException $a) {
75
+        }catch (AdminCredentialsException $a) {
76 76
             return UserController::showAdminManager();
77
-        } catch (SecurityException $s) {
77
+        }catch (SecurityException $s) {
78 78
             return $this->security->notAuthorized($this->actualUri);
79
-        } catch (RouterException $r) {
79
+        }catch (RouterException $r) {
80 80
             return $this->router->httpNotFound($r);
81
-        } catch (\Exception $e) {
81
+        }catch (\Exception $e) {
82 82
             return $this->dumpException($e);
83 83
         }
84 84
     }
Please login to merge, or discard this patch.
src/base/types/traits/OutputTrait.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -202,7 +202,7 @@
 block discarded – undo
202 202
 
203 203
     /**
204 204
      * Método que fuerza la descarga de un fichero
205
-     * @param $data
205
+     * @param string $data
206 206
      * @param string $content
207 207
      * @param string $filename
208 208
      * @return mixed
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
                 $this->setStatusCode(Template::STATUS_OK);
121 121
                 break;
122 122
             default:
123
-                $this->setStatusCode('HTTP/1.0 ' . $status ?: 200);
123
+                $this->setStatusCode('HTTP/1.0 '.$status ?: 200);
124 124
                 break;
125 125
         }
126 126
         return $this;
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
         ResponseHelper::setStatusHeader($this->getStatusCode());
139 139
         ResponseHelper::setAuthHeaders($this->isPublicZone());
140 140
         ResponseHelper::setCookieHeaders($cookies);
141
-        header('Content-type: ' . $contentType);
141
+        header('Content-type: '.$contentType);
142 142
 
143 143
     }
144 144
 
@@ -154,15 +154,15 @@  discard block
 block discarded – undo
154 154
         Logger::log('Start output response');
155 155
         ob_start();
156 156
         $this->setReponseHeaders($contentType, $cookies);
157
-        header('Content-length: ' . strlen($output));
157
+        header('Content-length: '.strlen($output));
158 158
 
159 159
         $needCache = Cache::needCache();
160 160
         $cache = Cache::getInstance();
161 161
         list($path, $cacheDataName) = $cache->getRequestCacheHash();
162 162
         if (false !== $needCache && $this->getStatusCode() === Template::STATUS_OK && null !== $cacheDataName) {
163 163
             Logger::log('Saving output response into cache');
164
-            $cache->storeData("json" . DIRECTORY_SEPARATOR . $path . $cacheDataName, $output);
165
-            $cache->storeData("json" . DIRECTORY_SEPARATOR . $path . $cacheDataName . ".headers", headers_list(), Cache::JSON);
164
+            $cache->storeData("json".DIRECTORY_SEPARATOR.$path.$cacheDataName, $output);
165
+            $cache->storeData("json".DIRECTORY_SEPARATOR.$path.$cacheDataName.".headers", headers_list(), Cache::JSON);
166 166
         } elseif (Request::getInstance()->getMethod() !== 'GET') {
167 167
             $cache->flushCache();
168 168
         }
@@ -182,11 +182,11 @@  discard block
 block discarded – undo
182 182
         Logger::log('Close template render');
183 183
         $uri = Request::requestUri();
184 184
         Security::getInstance()->setSessionKey("lastRequest", array(
185
-            "url" => Request::getInstance()->getRootUrl() . $uri,
185
+            "url" => Request::getInstance()->getRootUrl().$uri,
186 186
             "ts" => microtime(true),
187 187
         ));
188 188
         Security::getInstance()->updateSession();
189
-        Logger::log('End request: ' . $uri, LOG_INFO);
189
+        Logger::log('End request: '.$uri, LOG_INFO);
190 190
         exit;
191 191
     }
192 192
 
@@ -224,17 +224,17 @@  discard block
 block discarded – undo
224 224
         /////////////////////////////////////////////////////////////
225 225
         // Date in the past sets the value to already have been expired.
226 226
         header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
227
-        header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
227
+        header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
228 228
         header('Cache-Control: no-store, no-cache, must-revalidate'); // HTTP/1.1
229 229
         header('Cache-Control: pre-check=0, post-check=0, max-age=0'); // HTTP/1.1
230 230
         header("Pragma: no-cache");
231 231
         header("Expires: 0");
232 232
         header('Content-Transfer-Encoding: binary');
233
-        header("Content-type: " . $content);
234
-        header("Content-length: " . strlen($data));
235
-        header('Content-Disposition: attachment; filename="' . $filename . '"');
233
+        header("Content-type: ".$content);
234
+        header("Content-length: ".strlen($data));
235
+        header('Content-Disposition: attachment; filename="'.$filename.'"');
236 236
         header("Access-Control-Expose-Headers: Filename");
237
-        header("Filename: " . $filename);
237
+        header("Filename: ".$filename);
238 238
         echo $data;
239 239
         ob_flush();
240 240
         ob_end_clean();
Please login to merge, or discard this patch.
src/controller/DocumentorController.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
         $download = $this->getRequest()->get('download') ?: false;
34 34
 
35 35
         $module = $this->srv->getModules($domain);
36
-        if(empty($module)) {
36
+        if (empty($module)) {
37 37
             return Router::getInstance()->httpNotFound(null, true);
38 38
         }
39 39
         switch (strtolower($type)) {
@@ -53,11 +53,11 @@  discard block
 block discarded – undo
53 53
         ini_restore('max_execution_time');
54 54
         ini_restore('memory_limit');
55 55
 
56
-        if($download && $type === ApiController::SWAGGER_DOC) {
56
+        if ($download && $type === ApiController::SWAGGER_DOC) {
57 57
             return $this->download(\GuzzleHttp\json_encode($doc), 'application/json', 'swagger.json');
58
-        } elseif($type === ApiController::HTML_DOC) {
58
+        } elseif ($type === ApiController::HTML_DOC) {
59 59
             return $this->render('documentation.html.twig', ["data" => json_encode($doc)]);
60
-        } else {
60
+        }else {
61 61
             return $this->json($doc, 200);
62 62
         }
63 63
     }
Please login to merge, or discard this patch.