Passed
Push — master ( 412c28...27021d )
by Fran
04:12
created
src/functions.php 1 patch
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.
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/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/helpers/FileHelper.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
  */
8 8
 class FileHelper {
9 9
     /**
10
-     * @param mixed $data
10
+     * @param string $data
11 11
      * @param string $path
12 12
      * @return int
13 13
      */
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
 
18 18
     /**
19 19
      * @param string $path
20
-     * @return mixed|bool
20
+     * @return string|false
21 21
      */
22 22
     public static function readFile($path) {
23 23
         $data = false;
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@
 block discarded – undo
21 21
      */
22 22
     public static function readFile($path) {
23 23
         $data = false;
24
-        if(file_exists($path)) {
24
+        if (file_exists($path)) {
25 25
             $data = file_get_contents($path);
26 26
         }
27 27
         return $data;
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   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
                 $this->setStatusCode("HTTP/1.0 400 Bad Request");
118 118
                 break;
119 119
             default:
120
-                $this->setStatusCode('HTTP/1.0 ' . $status ?: 200);
120
+                $this->setStatusCode('HTTP/1.0 '.$status ?: 200);
121 121
                 break;
122 122
         }
123 123
         return $this;
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
         ResponseHelper::setStatusHeader($this->getStatusCode());
136 136
         ResponseHelper::setAuthHeaders($this->isPublicZone());
137 137
         ResponseHelper::setCookieHeaders($cookies);
138
-        header('Content-type: ' . $contentType);
138
+        header('Content-type: '.$contentType);
139 139
 
140 140
     }
141 141
 
@@ -151,15 +151,15 @@  discard block
 block discarded – undo
151 151
         Logger::log('Start output response');
152 152
         ob_start();
153 153
         $this->setReponseHeaders($contentType, $cookies);
154
-        header('Content-length: ' . strlen($output));
154
+        header('Content-length: '.strlen($output));
155 155
 
156 156
         $needCache = Cache::needCache();
157 157
         if (false !== $needCache && $this->getStatusCode() === Template::STATUS_OK) {
158 158
             $cache = Cache::getInstance();
159 159
             Logger::log('Saving output response into cache');
160 160
             list($path, $cacheDataName) = $cache->getRequestCacheHash();
161
-            $cache->storeData("json" . DIRECTORY_SEPARATOR . $path . $cacheDataName, $output);
162
-            $cache->storeData("json" . DIRECTORY_SEPARATOR . $path . $cacheDataName . ".headers", headers_list(), Cache::JSON);
161
+            $cache->storeData("json".DIRECTORY_SEPARATOR.$path.$cacheDataName, $output);
162
+            $cache->storeData("json".DIRECTORY_SEPARATOR.$path.$cacheDataName.".headers", headers_list(), Cache::JSON);
163 163
         }
164 164
         echo $output;
165 165
 
@@ -177,11 +177,11 @@  discard block
 block discarded – undo
177 177
         Logger::log('Close template render');
178 178
         $uri = Request::requestUri();
179 179
         Security::getInstance()->setSessionKey("lastRequest", array(
180
-            "url" => Request::getInstance()->getRootUrl() . $uri,
180
+            "url" => Request::getInstance()->getRootUrl().$uri,
181 181
             "ts" => microtime(true),
182 182
         ));
183 183
         Security::getInstance()->updateSession();
184
-        Logger::log('End request: ' . $uri, LOG_INFO);
184
+        Logger::log('End request: '.$uri, LOG_INFO);
185 185
         exit;
186 186
     }
187 187
 
@@ -219,15 +219,15 @@  discard block
 block discarded – undo
219 219
         /////////////////////////////////////////////////////////////
220 220
         // Date in the past sets the value to already have been expired.
221 221
         header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
222
-        header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
222
+        header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
223 223
         header('Cache-Control: no-store, no-cache, must-revalidate'); // HTTP/1.1
224 224
         header('Cache-Control: pre-check=0, post-check=0, max-age=0'); // HTTP/1.1
225 225
         header("Pragma: no-cache");
226 226
         header("Expires: 0");
227 227
         header('Content-Transfer-Encoding: none');
228
-        header("Content-type: " . $content);
229
-        header("Content-length: " . strlen($data));
230
-        header('Content-Disposition: attachment; filename="' . $filename . '"');
228
+        header("Content-type: ".$content);
229
+        header("Content-length: ".strlen($data));
230
+        header('Content-Disposition: attachment; filename="'.$filename.'"');
231 231
         echo $data;
232 232
         ob_flush();
233 233
         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.
src/base/Template.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
         $dump = '';
112 112
         try {
113 113
             $dump = $this->tpl->render($tpl, $vars);
114
-        } catch (\Exception $e) {
114
+        }catch (\Exception $e) {
115 115
             Logger::log($e->getMessage(), LOG_ERR);
116 116
         }
117 117
         return $dump;
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
     public function regenerateTemplates()
139 139
     {
140 140
         $this->generateTemplatesCache();
141
-        $domains = Cache::getInstance()->getDataFromFile(CONFIG_DIR . DIRECTORY_SEPARATOR . "domains.json", Cache::JSON, true);
141
+        $domains = Cache::getInstance()->getDataFromFile(CONFIG_DIR.DIRECTORY_SEPARATOR."domains.json", Cache::JSON, true);
142 142
         $translations = [];
143 143
         if (is_array($domains)) {
144 144
             $translations = $this->parsePathTranslations($domains);
@@ -160,8 +160,8 @@  discard block
 block discarded – undo
160 160
             // force compilation
161 161
             if ($file->isFile()) {
162 162
                 try {
163
-                    $this->tpl->load(str_replace($tplDir . '/', '', $file));
164
-                } catch (\Exception $e) {
163
+                    $this->tpl->load(str_replace($tplDir.'/', '', $file));
164
+                }catch (\Exception $e) {
165 165
                     Logger::log($e->getMessage(), LOG_ERR, ['file' => $e->getFile(), 'line' => $e->getLine()]);
166 166
                 }
167 167
             }
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
             'existsFlash' => TemplateFunctions::EXISTS_FLASH_FUNCTION,
222 222
             'getFlash' => TemplateFunctions::GET_FLASH_FUNCTION,
223 223
         ];
224
-        foreach($functions as $name => $function) {
224
+        foreach ($functions as $name => $function) {
225 225
             $this->addTemplateFunction($name, $function);
226 226
         }
227 227
     }
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
      */
241 241
     private function loadDomains()
242 242
     {
243
-        $domains = Cache::getInstance()->getDataFromFile(CONFIG_DIR . DIRECTORY_SEPARATOR . 'domains.json', Cache::JSON, true);
243
+        $domains = Cache::getInstance()->getDataFromFile(CONFIG_DIR.DIRECTORY_SEPARATOR.'domains.json', Cache::JSON, true);
244 244
         if (null !== $domains) {
245 245
             foreach ($domains as $domain => $paths) {
246 246
                 $this->addPath($paths['template'], preg_replace('/(@|\/)/', '', $domain));
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
     {
256 256
         $loader = new \Twig_Loader_Filesystem(GeneratorHelper::getTemplatePath());
257 257
         $this->tpl = new \Twig_Environment($loader, array(
258
-            'cache' => CACHE_DIR . DIRECTORY_SEPARATOR . 'twig',
258
+            'cache' => CACHE_DIR.DIRECTORY_SEPARATOR.'twig',
259 259
             'debug' => (bool)$this->debug,
260 260
             'auto_reload' => Config::getParam('twig.autoreload', TRUE),
261 261
         ));
Please login to merge, or discard this patch.