Passed
Push — master ( be5e48...f2f9fb )
by Fran
02:49
created
src/base/dto/Order.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@
 block discarded – undo
63 63
     {
64 64
         if (preg_match('/^asc$/i', $direction)) {
65 65
             return self::ASC;
66
-        } else {
66
+        }else {
67 67
             return self::DESC;
68 68
         }
69 69
     }
Please login to merge, or discard this patch.
src/Dispatcher.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -79,18 +79,18 @@
 block discarded – undo
79 79
                 if (!Request::getInstance()->isFile()) {
80 80
                     return $this->router->execute($uri ?: $this->actualUri);
81 81
                 }
82
-            } else {
82
+            }else {
83 83
                 return ConfigController::getInstance()->config();
84 84
             }
85
-        } catch (AdminCredentialsException $a) {
85
+        }catch (AdminCredentialsException $a) {
86 86
             return UserController::showAdminManager();
87
-        } catch (SecurityException $s) {
87
+        }catch (SecurityException $s) {
88 88
             return $this->security->notAuthorized($this->actualUri);
89
-        } catch (RouterException $r) {
89
+        }catch (RouterException $r) {
90 90
             return $this->router->httpNotFound($r);
91
-        } catch (ApiException $a) {
91
+        }catch (ApiException $a) {
92 92
             return $this->router->httpNotFound($a, true);
93
-        } catch (\Exception $e) {
93
+        }catch (\Exception $e) {
94 94
             return $this->dumpException($e);
95 95
         }
96 96
     }
Please login to merge, or discard this patch.
src/base/Logger.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -18,8 +18,8 @@  discard block
 block discarded – undo
18 18
 
19 19
 
20 20
 if (!defined('LOG_DIR')) {
21
-    GeneratorHelper::createDir(BASE_DIR . DIRECTORY_SEPARATOR . 'logs');
22
-    define('LOG_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'logs');
21
+    GeneratorHelper::createDir(BASE_DIR.DIRECTORY_SEPARATOR.'logs');
22
+    define('LOG_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'logs');
23 23
 }
24 24
 
25 25
 /**
@@ -59,10 +59,10 @@  discard block
 block discarded – undo
59 59
     {
60 60
         $args = func_get_args();
61 61
         list($logger, $debug, $path) = $this->setup($args);
62
-        $this->stream = fopen($path . DIRECTORY_SEPARATOR . date('Ymd') . '.log', 'ab+');
62
+        $this->stream = fopen($path.DIRECTORY_SEPARATOR.date('Ymd').'.log', 'ab+');
63 63
         if (false !== $this->stream && is_resource($this->stream)) {
64 64
             $this->addPushLogger($logger, $debug);
65
-        } else {
65
+        }else {
66 66
             throw new ConfigException(t('Error creating logger'));
67 67
         }
68 68
         $this->logLevel = strtoupper(Config::getParam('log.level', 'NOTICE'));
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
     private function createLoggerPath(): string
142 142
     {
143 143
         $logger = $this->setLoggerName();
144
-        $path = Config::getParam('default.log.path', LOG_DIR) . DIRECTORY_SEPARATOR . $logger . DIRECTORY_SEPARATOR . date('Y') . DIRECTORY_SEPARATOR . date('m');
144
+        $path = Config::getParam('default.log.path', LOG_DIR).DIRECTORY_SEPARATOR.$logger.DIRECTORY_SEPARATOR.date('Y').DIRECTORY_SEPARATOR.date('m');
145 145
         GeneratorHelper::createDir($path);
146 146
         return $path;
147 147
     }
Please login to merge, or discard this patch.
src/base/types/helpers/ServerHelper.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@
 block discarded – undo
27 27
      */
28 28
     public static function dropServerValue(string $key): void
29 29
     {
30
-        if(array_key_exists($key, $_SERVER)) {
30
+        if (array_key_exists($key, $_SERVER)) {
31 31
             unset($_SERVER[$key]);
32 32
         }
33 33
     }
Please login to merge, or discard this patch.
src/base/types/traits/SystemTrait.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
                 $use /= 1024;
41 41
                 break;
42 42
             case "MBytes":
43
-                $use /= (1024 * 1024);
43
+                $use /= (1024*1024);
44 44
                 break;
45 45
             case "Bytes":
46 46
             default:
@@ -70,12 +70,12 @@  discard block
 block discarded – undo
70 70
             ini_set('display_errors', 1);
71 71
         }
72 72
         //Warning & Notice handler
73
-        set_error_handler(function ($errno, $errstr, $errfile, $errline) {
73
+        set_error_handler(function($errno, $errstr, $errfile, $errline) {
74 74
             Logger::log($errstr, LOG_CRIT, ['file' => $errfile, 'line' => $errline, 'errno' => $errno]);
75 75
             return true;
76 76
         }, E_ALL | E_STRICT | E_DEPRECATED | E_USER_DEPRECATED | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR);
77 77
 
78
-        register_shutdown_function(function () {
78
+        register_shutdown_function(function() {
79 79
             $error = error_get_last() or json_last_error() or preg_last_error() or \DateTime::getLastErrors();
80 80
             if ($error !== NULL) {
81 81
                 $errno = $error["type"];
@@ -90,8 +90,8 @@  discard block
 block discarded – undo
90 90
 
91 91
             if (self::getTs() > 10 && null !== Config::getParam('log.slack.hook')) {
92 92
                 SlackHelper::getInstance()->trace('Slow service endpoint', '', '', [
93
-                    'time' => round(self::getTs(), 3) . ' secs',
94
-                    'memory' => round(self::getMem('MBytes'), 3) . ' Mb',
93
+                    'time' => round(self::getTs(), 3).' secs',
94
+                    'memory' => round(self::getMem('MBytes'), 3).' Mb',
95 95
                 ]);
96 96
             }
97 97
             return false;
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
         Inspector::stats('[SystemTrait] Initializing stats (mem + ts)');
107 107
         if (ServerHelper::hasServerValue('REQUEST_TIME_FLOAT')) {
108 108
             $this->ts = (float)ServerHelper::getServerValue('REQUEST_TIME_FLOAT');
109
-        } else {
109
+        }else {
110 110
             $this->ts = PSFS_START_TS;
111 111
         }
112 112
         $this->mem = PSFS_START_MEM;
Please login to merge, or discard this patch.
src/base/config/Config.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
      */
98 98
     protected function init()
99 99
     {
100
-        if (file_exists(CONFIG_DIR . DIRECTORY_SEPARATOR . self::CONFIG_FILE)) {
100
+        if (file_exists(CONFIG_DIR.DIRECTORY_SEPARATOR.self::CONFIG_FILE)) {
101 101
             $this->loadConfigData();
102 102
         }
103 103
         return $this;
@@ -212,13 +212,13 @@  discard block
 block discarded – undo
212 212
         $finalData = self::saveExtraParams($data);
213 213
         $saved = false;
214 214
         try {
215
-            $finalData = array_filter($finalData, function ($key, $value) {
215
+            $finalData = array_filter($finalData, function($key, $value) {
216 216
                 return in_array($key, self::$required, true) || !empty($value);
217 217
             }, ARRAY_FILTER_USE_BOTH);
218
-            $saved = (false !== file_put_contents(CONFIG_DIR . DIRECTORY_SEPARATOR . self::CONFIG_FILE, json_encode($finalData, JSON_PRETTY_PRINT)));
218
+            $saved = (false !== file_put_contents(CONFIG_DIR.DIRECTORY_SEPARATOR.self::CONFIG_FILE, json_encode($finalData, JSON_PRETTY_PRINT)));
219 219
             self::getInstance()->loadConfigData();
220 220
             $saved = true;
221
-        } catch (ConfigException $e) {
221
+        }catch (ConfigException $e) {
222 222
             Logger::log($e->getMessage(), LOG_ERR);
223 223
         }
224 224
         return $saved;
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
      */
251 251
     public function loadConfigData(): void
252 252
     {
253
-        $this->config = json_decode(file_get_contents(CONFIG_DIR . DIRECTORY_SEPARATOR . self::CONFIG_FILE), true) ?: [];
253
+        $this->config = json_decode(file_get_contents(CONFIG_DIR.DIRECTORY_SEPARATOR.self::CONFIG_FILE), true) ?: [];
254 254
         $this->debug = array_key_exists('debug', $this->config) ? (bool)$this->config['debug'] : FALSE;
255 255
         if (array_key_exists('cache.var', $this->config)) {
256 256
             Security::getInstance()->setSessionKey('config.cache.var', $this->config['cache.var']);
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
     public static function getParam($key, $defaultValue = null, $module = null)
276 276
     {
277 277
         if (null !== $module) {
278
-            return self::getParam(strtolower($module) . '.' . $key, self::getParam($key, $defaultValue));
278
+            return self::getParam(strtolower($module).'.'.$key, self::getParam($key, $defaultValue));
279 279
         }
280 280
         $param = self::getInstance()->get($key);
281 281
         return (null !== $param) ? $param : $defaultValue;
@@ -291,8 +291,8 @@  discard block
 block discarded – undo
291 291
     {
292 292
         $done = true;
293 293
         foreach (self::$cleanable_config_files as $configFile) {
294
-            if (file_exists(CONFIG_DIR . DIRECTORY_SEPARATOR . $configFile)) {
295
-                if (!unlink(CONFIG_DIR . DIRECTORY_SEPARATOR . $configFile)) {
294
+            if (file_exists(CONFIG_DIR.DIRECTORY_SEPARATOR.$configFile)) {
295
+                if (!unlink(CONFIG_DIR.DIRECTORY_SEPARATOR.$configFile)) {
296 296
                     $done = false;
297 297
                 }
298 298
             }
Please login to merge, or discard this patch.
src/base/events/CloseSessionEvent.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,10 +12,10 @@
 block discarded – undo
12 12
     {
13 13
         $uri = Request::requestUri();
14 14
         Security::getInstance()->setSessionKey('lastRequest', array(
15
-            'url' => Request::getInstance()->getRootUrl() . $uri,
15
+            'url' => Request::getInstance()->getRootUrl().$uri,
16 16
             'ts' => microtime(true),
17 17
             'eta' => microtime(true) - PSFS_START_TS,
18
-            'mem' => memory_get_usage() / 1024 / 1024,
18
+            'mem' => memory_get_usage()/1024/1024,
19 19
         ));
20 20
         Security::getInstance()->updateSession();
21 21
         return EventInterface::EVENT_SUCCESS;
Please login to merge, or discard this patch.
src/services/AdminServices.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
     {
37 37
         $platform = trim(Config::getInstance()->get('platform.name', 'PSFS'));
38 38
         ResponseHelper::setHeader('HTTP/1.1 401 Unauthorized');
39
-        ResponseHelper::setHeader('WWW-Authenticate: Basic Realm="' . $platform . '"');
39
+        ResponseHelper::setHeader('WWW-Authenticate: Basic Realm="'.$platform.'"');
40 40
         echo t('Zona restringida');
41 41
         exit();
42 42
     }
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
                             $admin['class'] = 'primary';
79 79
                             break;
80 80
                     }
81
-                } else {
81
+                }else {
82 82
                     $admin['class'] = 'primary';
83 83
                 }
84 84
             }
Please login to merge, or discard this patch.
src/base/types/traits/OutputTrait.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
                 $this->setStatusCode(Template::STATUS_OK);
128 128
                 break;
129 129
             default:
130
-                $this->setStatusCode('HTTP/1.0 ' . ($status ?: 200));
130
+                $this->setStatusCode('HTTP/1.0 '.($status ?: 200));
131 131
                 break;
132 132
         }
133 133
         return $this;
@@ -140,11 +140,11 @@  discard block
 block discarded – undo
140 140
      */
141 141
     private function setResponseHeaders($contentType = 'text/html', array $cookies = array()): void
142 142
     {
143
-        ResponseHelper::setHeader('X-Powered-By: ' . Config::getParam('poweredBy', 'PSFS'));
143
+        ResponseHelper::setHeader('X-Powered-By: '.Config::getParam('poweredBy', 'PSFS'));
144 144
         ResponseHelper::setStatusHeader($this->getStatusCode());
145 145
         ResponseHelper::setAuthHeaders($this->isPublicZone());
146 146
         ResponseHelper::setCookieHeaders($cookies);
147
-        ResponseHelper::setHeader('Content-type: ' . $contentType);
147
+        ResponseHelper::setHeader('Content-type: '.$contentType);
148 148
 
149 149
     }
150 150
 
@@ -162,16 +162,16 @@  discard block
 block discarded – undo
162 162
             Logger::log('Start output response');
163 163
             ob_start();
164 164
             $this->setResponseHeaders($contentType, $cookies);
165
-            ResponseHelper::setHeader('Content-length: ' . strlen($output));
166
-            ResponseHelper::setHeader('CRC: ' . crc32($output));
165
+            ResponseHelper::setHeader('Content-length: '.strlen($output));
166
+            ResponseHelper::setHeader('CRC: '.crc32($output));
167 167
 
168 168
             $needCache = Cache::needCache();
169 169
             $cache = Cache::getInstance();
170 170
             list($path, $cacheDataName) = $cache->getRequestCacheHash();
171 171
             if (null !== $cacheDataName && false !== $needCache && $this->getStatusCode() === Template::STATUS_OK) {
172 172
                 Logger::log('Saving output response into cache');
173
-                $cache->storeData('json' . DIRECTORY_SEPARATOR . $path . $cacheDataName, $output);
174
-                $cache->storeData('json' . DIRECTORY_SEPARATOR . $path . $cacheDataName . '.headers', headers_list(), Cache::JSON);
173
+                $cache->storeData('json'.DIRECTORY_SEPARATOR.$path.$cacheDataName, $output);
174
+                $cache->storeData('json'.DIRECTORY_SEPARATOR.$path.$cacheDataName.'.headers', headers_list(), Cache::JSON);
175 175
             } elseif (Request::getInstance()->getMethod() !== 'GET') {
176 176
                 $cache->flushCache();
177 177
             }
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
             ob_end_clean();
182 182
             Logger::log('End output response');
183 183
             $this->closeRender();
184
-        } else {
184
+        }else {
185 185
             return $output;
186 186
         }
187 187
     }
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
     {
194 194
         Logger::log('Close template render');
195 195
         EventHelper::handleEvents(EventHelper::EVENT_END_REQUEST);
196
-        Logger::log('End request: ' . Request::requestUri(), LOG_INFO);
196
+        Logger::log('End request: '.Request::requestUri(), LOG_INFO);
197 197
         exit;
198 198
     }
199 199
 
@@ -231,17 +231,17 @@  discard block
 block discarded – undo
231 231
         /////////////////////////////////////////////////////////////
232 232
         // Date in the past sets the value to already have been expired.
233 233
         ResponseHelper::setHeader('Expires: Sat, 26 Jul 1997 05:00:00 GMT');
234
-        ResponseHelper::setHeader('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
234
+        ResponseHelper::setHeader('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
235 235
         ResponseHelper::setHeader('Cache-Control: no-store, no-cache, must-revalidate'); // HTTP/1.1
236 236
         ResponseHelper::setHeader('Cache-Control: pre-check=0, post-check=0, max-age=0'); // HTTP/1.1
237 237
         ResponseHelper::setHeader('Pragma: no-cache');
238 238
         ResponseHelper::setHeader('Expires: 0');
239 239
         ResponseHelper::setHeader('Content-Transfer-Encoding: binary');
240
-        ResponseHelper::setHeader('Content-type: ' . $content);
241
-        ResponseHelper::setHeader('Content-length: ' . strlen($data));
242
-        ResponseHelper::setHeader('Content-Disposition: attachment; filename="' . $filename . '"');
240
+        ResponseHelper::setHeader('Content-type: '.$content);
241
+        ResponseHelper::setHeader('Content-length: '.strlen($data));
242
+        ResponseHelper::setHeader('Content-Disposition: attachment; filename="'.$filename.'"');
243 243
         ResponseHelper::setHeader('Access-Control-Expose-Headers: Filename');
244
-        ResponseHelper::setHeader('Filename: ' . $filename);
244
+        ResponseHelper::setHeader('Filename: '.$filename);
245 245
         echo $data;
246 246
         ob_flush();
247 247
         ob_end_clean();
Please login to merge, or discard this patch.