Passed
Push — master ( 6dd2bc...be6a60 )
by Fran
03:47
created
src/base/types/helpers/SlackHelper.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
             'attachments' => [
31 31
                 [
32 32
                     "author_name" => $request->getRootUrl(true),
33
-                    "text" => $file . ($line !== '' ? ' [' . $line . ']' : ''),
33
+                    "text" => $file.($line !== '' ? ' ['.$line.']' : ''),
34 34
                     "color" => Config::getParam('debug', true) ? 'warning' : "danger",
35 35
                     "title" => $message,
36 36
                     'fallback' => 'PSFS Error notifier',
Please login to merge, or discard this patch.
src/base/types/helpers/RouterHelper.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -24,11 +24,11 @@  discard block
 block discarded – undo
24 24
     {
25 25
         Inspector::stats('[RouterHelper] Getting class to call for executing the request action', Inspector::SCOPE_DEBUG);
26 26
         Logger::log('Getting class to call for executing the request action', LOG_DEBUG, $action);
27
-        $actionClass = class_exists($action['class']) ? $action['class'] : "\\" . $action['class'];
27
+        $actionClass = class_exists($action['class']) ? $action['class'] : "\\".$action['class'];
28 28
         $reflectionClass = new ReflectionClass($actionClass);
29 29
         if ($reflectionClass->hasMethod('getInstance')) {
30 30
             $class = $reflectionClass->getMethod('getInstance')->invoke(null, $action['method']);
31
-        } else {
31
+        }else {
32 32
             $class = new $actionClass;
33 33
         }
34 34
         return $class;
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
     public static function extractComponents($route, $pattern)
63 63
     {
64 64
         Inspector::stats('[RouterHelper] Extracting parts for the request to execute', Inspector::SCOPE_DEBUG);
65
-        if(Config::getParam('allow.double.slashes', true)) {
65
+        if (Config::getParam('allow.double.slashes', true)) {
66 66
             $route = preg_replace("/\/\//", '/', $route);
67 67
         }
68 68
         $url = parse_url($route);
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
             $cleanPatternSep--;
101 101
         }
102 102
 
103
-        if(Config::getParam('allow.double.slashes', true)) {
103
+        if (Config::getParam('allow.double.slashes', true)) {
104 104
             $path = preg_replace("/\/\//", '/', $path);
105 105
         }
106 106
         $pathSep = count(explode('/', $path));
@@ -120,14 +120,14 @@  discard block
 block discarded – undo
120 120
      */
121 121
     public static function matchRoutePattern($routePattern, $path)
122 122
     {
123
-        if(Config::getParam('allow.double.slashes', true)) {
123
+        if (Config::getParam('allow.double.slashes', true)) {
124 124
             $path = preg_replace("/\/\//", '/', $path);
125 125
         }
126 126
         $expr = preg_replace('/\{([^}]+)\}/', '%%%', $routePattern);
127 127
         $expr = preg_quote($expr, '/');
128 128
         $expr = str_replace('%%%', '(.*)', $expr);
129 129
         $expr2 = preg_replace('/\(\.\*\)$/', '', $expr);
130
-        $matched = preg_match('/^' . $expr . '\/?$/i', $path) || preg_match('/^' . $expr2 . '?$/i', $path);
130
+        $matched = preg_match('/^'.$expr.'\/?$/i', $path) || preg_match('/^'.$expr2.'?$/i', $path);
131 131
         return $matched;
132 132
     }
133 133
 
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
      */
139 139
     public static function extractDomainInfo(ReflectionClass $class, $domain)
140 140
     {
141
-        $path = dirname($class->getFileName()) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR;
141
+        $path = dirname($class->getFileName()).DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR;
142 142
         $templatesPath = 'templates';
143 143
         $publicPath = 'public';
144 144
         $modelsPath = 'models';
@@ -148,13 +148,13 @@  discard block
 block discarded – undo
148 148
             $modelsPath = ucfirst($modelsPath);
149 149
         }
150 150
         if ($class->hasConstant('TPL')) {
151
-            $templatesPath .= DIRECTORY_SEPARATOR . $class->getConstant('TPL');
151
+            $templatesPath .= DIRECTORY_SEPARATOR.$class->getConstant('TPL');
152 152
         }
153 153
         return [
154 154
             'base' => $path,
155
-            'template' => $path . $templatesPath,
156
-            'model' => $path . $modelsPath,
157
-            'public' => $path . $publicPath,
155
+            'template' => $path.$templatesPath,
156
+            'model' => $path.$modelsPath,
157
+            'public' => $path.$publicPath,
158 158
         ];
159 159
     }
160 160
 
@@ -175,12 +175,12 @@  discard block
 block discarded – undo
175 175
             foreach ($parameters as $param) {
176 176
                 if ($param->isOptional() && !is_array($param->getDefaultValue())) {
177 177
                     $params[$param->getName()] = $param->getDefaultValue();
178
-                    $default = str_replace('{' . $param->getName() . '}', $param->getDefaultValue(), $regex);
178
+                    $default = str_replace('{'.$param->getName().'}', $param->getDefaultValue(), $regex);
179 179
                 } elseif (!$param->isOptional()) {
180 180
                     $requirements[] = $param->getName();
181 181
                 }
182 182
             }
183
-        } else {
183
+        }else {
184 184
             $default = $regex;
185 185
         }
186 186
 
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
             $httpMethod = AnnotationHelper::extractReflectionHttpMethod($docComments);
211 211
             $icon = AnnotationHelper::extractDocIcon($docComments);
212 212
             $label = AnnotationHelper::extractReflectionLabel(str_replace('{__API__}', $api, $docComments));
213
-            $route = $httpMethod . "#|#" . $regex;
213
+            $route = $httpMethod."#|#".$regex;
214 214
             $route = preg_replace('/(\\r|\\f|\\t|\\n)/', '', $route);
215 215
             $info = [
216 216
                 'method' => $method->getName(),
Please login to merge, or discard this patch.
src/base/Request.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
      */
123 123
     public static function header($name, $default = null)
124 124
     {
125
-        return self::getInstance()->getHeader($name,  $default);
125
+        return self::getInstance()->getHeader($name, $default);
126 126
     }
127 127
 
128 128
     /**
@@ -135,10 +135,10 @@  discard block
 block discarded – undo
135 135
         $header = null;
136 136
         if ($this->hasHeader($name)) {
137 137
             $header = $this->header[$name];
138
-        } else if(array_key_exists('h_' . strtolower($name), $this->query)) {
139
-            $header = $this->query['h_' . strtolower($name)];
140
-        } else if(array_key_exists('HTTP_' . strtoupper(str_replace('-', '_', $name)), $this->server)) {
141
-            $header = $this->getServer('HTTP_' . strtoupper(str_replace('-', '_', $name)));
138
+        }else if (array_key_exists('h_'.strtolower($name), $this->query)) {
139
+            $header = $this->query['h_'.strtolower($name)];
140
+        }else if (array_key_exists('HTTP_'.strtoupper(str_replace('-', '_', $name)), $this->server)) {
141
+            $header = $this->getServer('HTTP_'.strtoupper(str_replace('-', '_', $name)));
142 142
         }
143 143
         return $header ?: $default;
144 144
     }
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
             $url = $this->getServer('HTTP_ORIGIN');
243 243
         }
244 244
         ob_start();
245
-        header('Location: ' . $url);
245
+        header('Location: '.$url);
246 246
         ob_end_clean();
247 247
         Security::getInstance()->updateSession();
248 248
         exit(t('Redirect...'));
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
         $url = $this->getServerName();
259 259
         $protocol = $hasProtocol ? $this->getProtocol() : '';
260 260
         if (!empty($protocol)) {
261
-            $url = $protocol . $url;
261
+            $url = $protocol.$url;
262 262
         }
263 263
         $url = $this->checkServerPort($url);
264 264
         return $url;
@@ -272,15 +272,15 @@  discard block
 block discarded – undo
272 272
     {
273 273
         $port = (integer)$this->getServer('SERVER_PORT');
274 274
         $host = $this->getServer('HTTP_HOST');
275
-        if(!empty($host)) {
275
+        if (!empty($host)) {
276 276
             $parts = explode(':', $host);
277 277
             $hostPort = (integer)end($parts);
278
-            if($hostPort !== $port && count($parts) > 1) {
278
+            if ($hostPort !== $port && count($parts) > 1) {
279 279
                 $port = $hostPort;
280 280
             }
281 281
         }
282 282
         if (!in_array($port, [80, 443], true)) {
283
-            $url .= ':' . $port;
283
+            $url .= ':'.$port;
284 284
         }
285 285
         return $url;
286 286
     }
Please login to merge, or discard this patch.
src/base/Router.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -62,8 +62,8 @@  discard block
 block discarded – undo
62 62
      */
63 63
     public function init()
64 64
     {
65
-        list($this->routing, $this->slugs) = $this->cache->getDataFromFile(CONFIG_DIR . DIRECTORY_SEPARATOR . 'urls.json', $this->cacheType, TRUE);
66
-        $this->domains = $this->cache->getDataFromFile(CONFIG_DIR . DIRECTORY_SEPARATOR . 'domains.json', $this->cacheType, TRUE);
65
+        list($this->routing, $this->slugs) = $this->cache->getDataFromFile(CONFIG_DIR.DIRECTORY_SEPARATOR.'urls.json', $this->cacheType, TRUE);
66
+        $this->domains = $this->cache->getDataFromFile(CONFIG_DIR.DIRECTORY_SEPARATOR.'domains.json', $this->cacheType, TRUE);
67 67
         if (empty($this->routing) || Config::getParam('debug', true)) {
68 68
             $this->debugLoad();
69 69
         }
@@ -98,13 +98,13 @@  discard block
 block discarded – undo
98 98
         try {
99 99
             //Search action and execute
100 100
             return $this->searchAction($route);
101
-        } catch (AccessDeniedException $e) {
102
-            Logger::log(t('Solicitamos credenciales de acceso a zona restringida'), LOG_WARNING, ['file' => $e->getFile() . '[' . $e->getLine() . ']']);
101
+        }catch (AccessDeniedException $e) {
102
+            Logger::log(t('Solicitamos credenciales de acceso a zona restringida'), LOG_WARNING, ['file' => $e->getFile().'['.$e->getLine().']']);
103 103
             return Admin::staticAdminLogon();
104
-        } catch (RouterException $r) {
104
+        }catch (RouterException $r) {
105 105
             Logger::log($r->getMessage(), LOG_WARNING);
106 106
             $code = $r->getCode();
107
-        } catch (Exception $e) {
107
+        }catch (Exception $e) {
108 108
             Logger::log($e->getMessage(), LOG_ERR);
109 109
             throw $e;
110 110
         }
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
      */
123 123
     protected function searchAction($route)
124 124
     {
125
-        Inspector::stats('[Router] Searching action to execute: ' . $route, Inspector::SCOPE_DEBUG);
125
+        Inspector::stats('[Router] Searching action to execute: '.$route, Inspector::SCOPE_DEBUG);
126 126
         //Revisamos si tenemos la ruta registrada
127 127
         $parts = parse_url($route);
128 128
         $path = array_key_exists('path', $parts) ? $parts['path'] : $route;
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
                     }
143 143
 
144 144
                     throw new RouterException(t('Preconditions failed'), 412);
145
-                } catch (Exception $e) {
145
+                }catch (Exception $e) {
146 146
                     Logger::log($e->getMessage(), LOG_ERR);
147 147
                     throw $e;
148 148
                 }
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
                 }
168 168
             }
169 169
             $valid = count($action['requirements']) === $checked;
170
-        } else {
170
+        }else {
171 171
             $valid = true;
172 172
         }
173 173
         return $valid;
@@ -190,11 +190,11 @@  discard block
 block discarded – undo
190 190
             if ($modules->hasResults()) {
191 191
                 foreach ($modules->getIterator() as $modulePath) {
192 192
                     $module = $modulePath->getBasename();
193
-                    $this->routing = $this->inspectDir($modulesPath . DIRECTORY_SEPARATOR . $module, $module, $this->routing);
193
+                    $this->routing = $this->inspectDir($modulesPath.DIRECTORY_SEPARATOR.$module, $module, $this->routing);
194 194
                 }
195 195
             }
196 196
         }
197
-        $this->cache->storeData(CONFIG_DIR . DIRECTORY_SEPARATOR . 'domains.json', $this->domains, Cache::JSON, TRUE);
197
+        $this->cache->storeData(CONFIG_DIR.DIRECTORY_SEPARATOR.'domains.json', $this->domains, Cache::JSON, TRUE);
198 198
     }
199 199
 
200 200
     /**
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
             $homeParams = NULL;
212 212
             foreach ($this->routing as $pattern => $params) {
213 213
                 list($method, $route) = RouterHelper::extractHttpRoute($pattern);
214
-                if (preg_match('/' . preg_quote($route, '/') . '$/i', '/' . $home)) {
214
+                if (preg_match('/'.preg_quote($route, '/').'$/i', '/'.$home)) {
215 215
                     $homeParams = $params;
216 216
                 }
217 217
                 unset($method);
@@ -243,18 +243,18 @@  discard block
 block discarded – undo
243 243
     {
244 244
         $baseUrl = $absolute ? Request::getInstance()->getRootUrl() : '';
245 245
         if ('' === $slug) {
246
-            return $baseUrl . '/';
246
+            return $baseUrl.'/';
247 247
         }
248 248
         if (!is_array($this->slugs) || !array_key_exists($slug, $this->slugs)) {
249 249
             throw new RouterException(t('No existe la ruta especificada'));
250 250
         }
251
-        $url = $baseUrl . $this->slugs[$slug];
251
+        $url = $baseUrl.$this->slugs[$slug];
252 252
         if (!empty($params)) {
253 253
             foreach ($params as $key => $value) {
254
-                $url = str_replace('{' . $key . '}', $value, $url);
254
+                $url = str_replace('{'.$key.'}', $value, $url);
255 255
             }
256 256
         } elseif (!empty($this->routing[$this->slugs[$slug]]['default'])) {
257
-            $url = $baseUrl . $this->routing[$this->slugs[$slug]]['default'];
257
+            $url = $baseUrl.$this->routing[$this->slugs[$slug]]['default'];
258 258
         }
259 259
 
260 260
         return preg_replace('/(GET|POST|PUT|DELETE|ALL|HEAD|PATCH)\#\|\#/', '', $url);
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
      */
267 267
     private function checkPreActions($class, $method)
268 268
     {
269
-        $preAction = 'pre' . ucfirst($method);
269
+        $preAction = 'pre'.ucfirst($method);
270 270
         if (method_exists($class, $preAction)) {
271 271
             Inspector::stats('[Router] Pre action invoked', Inspector::SCOPE_DEBUG);
272 272
             try {
@@ -274,7 +274,7 @@  discard block
 block discarded – undo
274 274
                     Logger::log(t('Pre action failed'), LOG_ERR, [error_get_last()]);
275 275
                     error_clear_last();
276 276
                 }
277
-            } catch (Exception $e) {
277
+            }catch (Exception $e) {
278 278
                 Logger::log($e->getMessage(), LOG_ERR, [$class, $method]);
279 279
             }
280 280
         }
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
      */
292 292
     protected function executeCachedRoute($route, $action, $class, $params = NULL)
293 293
     {
294
-        Inspector::stats('[Router] Executing route ' . $route, Inspector::SCOPE_DEBUG);
294
+        Inspector::stats('[Router] Executing route '.$route, Inspector::SCOPE_DEBUG);
295 295
         $action['params'] = array_merge($action['params'], $params, Request::getInstance()->getQueryParams());
296 296
         Security::getInstance()->setSessionKey(Cache::CACHE_SESSION_VAR, $action);
297 297
         $cache = Cache::needCache();
@@ -299,15 +299,15 @@  discard block
 block discarded – undo
299 299
         $return = null;
300 300
         if (FALSE !== $cache && $action['http'] === 'GET' && Config::getParam('debug') === FALSE) {
301 301
             list($path, $cacheDataName) = $this->cache->getRequestCacheHash();
302
-            $cachedData = $this->cache->readFromCache('json' . DIRECTORY_SEPARATOR . $path . $cacheDataName, $cache);
302
+            $cachedData = $this->cache->readFromCache('json'.DIRECTORY_SEPARATOR.$path.$cacheDataName, $cache);
303 303
             if (NULL !== $cachedData) {
304
-                $headers = $this->cache->readFromCache('json' . DIRECTORY_SEPARATOR . $path . $cacheDataName . '.headers', $cache, null, Cache::JSON);
304
+                $headers = $this->cache->readFromCache('json'.DIRECTORY_SEPARATOR.$path.$cacheDataName.'.headers', $cache, null, Cache::JSON);
305 305
                 Template::getInstance()->renderCache($cachedData, $headers);
306 306
                 $execute = FALSE;
307 307
             }
308 308
         }
309 309
         if ($execute) {
310
-            Inspector::stats('[Router] Start executing action ' . $route, Inspector::SCOPE_DEBUG);
310
+            Inspector::stats('[Router] Start executing action '.$route, Inspector::SCOPE_DEBUG);
311 311
             $this->checkPreActions($class, $action['method']);
312 312
             $return = call_user_func_array([$class, $action['method']], $params);
313 313
             if (false === $return) {
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
 /**
@@ -57,10 +57,10 @@  discard block
 block discarded – undo
57 57
     {
58 58
         $args = func_get_args();
59 59
         list($logger, $debug, $path) = $this->setup($args);
60
-        $this->stream = fopen($path . DIRECTORY_SEPARATOR . date('Ymd') . '.log', 'ab+');
60
+        $this->stream = fopen($path.DIRECTORY_SEPARATOR.date('Ymd').'.log', 'ab+');
61 61
         if (false !== $this->stream && is_resource($this->stream)) {
62 62
             $this->addPushLogger($logger, $debug);
63
-        } else {
63
+        }else {
64 64
             throw new ConfigException(t('Error creating logger'));
65 65
         }
66 66
         $this->logLevel = strtoupper(Config::getParam('log.level', 'NOTICE'));
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
     private function createLoggerPath()
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/dto/Dto.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
     public function __construct($hydrate = true)
20 20
     {
21 21
         parent::__construct();
22
-        if($hydrate) {
22
+        if ($hydrate) {
23 23
             $this->fromArray(Request::getInstance()->getData());
24 24
         }
25 25
     }
@@ -47,23 +47,23 @@  discard block
 block discarded – undo
47 47
                 /** @var \ReflectionProperty $property */
48 48
                 foreach ($properties as $property) {
49 49
                     $value = $property->getValue($this);
50
-                    if(is_object($value) && method_exists($value, 'toArray')) {
50
+                    if (is_object($value) && method_exists($value, 'toArray')) {
51 51
                         $dto[$property->getName()] = $value->toArray();
52
-                    } elseif(is_array($value)) {
53
-                        foreach($value as &$arrValue) {
54
-                            if($arrValue instanceof Dto) {
52
+                    } elseif (is_array($value)) {
53
+                        foreach ($value as &$arrValue) {
54
+                            if ($arrValue instanceof Dto) {
55 55
                                 $arrValue = $arrValue->toArray();
56 56
                             }
57 57
                         }
58 58
                         $dto[$property->getName()] = $value;
59
-                    } else {
59
+                    }else {
60 60
                         $type = InjectorHelper::extractVarType($property->getDocComment());
61 61
                         $dto[$property->getName()] = $this->checkCastedValue($property->getValue($this), $type);
62 62
                     }
63 63
                 }
64 64
             }
65
-        } catch (\Exception $e) {
66
-            Logger::log(get_class($this) . ': ' . $e->getMessage(), LOG_ERR);
65
+        }catch (\Exception $e) {
66
+            Logger::log(get_class($this).': '.$e->getMessage(), LOG_ERR);
67 67
         }
68 68
         return $dto;
69 69
     }
@@ -86,26 +86,26 @@  discard block
 block discarded – undo
86 86
     protected function parseDtoField(array $properties, $key, $value = null) {
87 87
         list($type, $isArray) = $this->extractTypes($properties, $key);
88 88
         $reflector = (class_exists($type)) ? new \ReflectionClass($type) : null;
89
-        if(null !== $reflector && $reflector->isSubclassOf(Dto::class)) {
90
-            if(null !== $value && is_array($value)) {
91
-                if(!array_key_exists($type, $this->__cache)) {
89
+        if (null !== $reflector && $reflector->isSubclassOf(Dto::class)) {
90
+            if (null !== $value && is_array($value)) {
91
+                if (!array_key_exists($type, $this->__cache)) {
92 92
                     $this->__cache[$type] = new $type(false);
93 93
                 }
94
-                if($isArray) {
94
+                if ($isArray) {
95 95
                     $this->$key = [];
96
-                    foreach($value as $data) {
97
-                        if(null !== $data && is_array($data)) {
96
+                    foreach ($value as $data) {
97
+                        if (null !== $data && is_array($data)) {
98 98
                             $dto = clone $this->__cache[$type];
99 99
                             $dto->fromArray($data);
100 100
                             array_push($this->$key, $dto);
101 101
                         }
102 102
                     }
103
-                } else {
103
+                }else {
104 104
                     $this->$key = clone $this->__cache[$type];
105 105
                     $this->$key->fromArray($value);
106 106
                 }
107 107
             }
108
-        } else {
108
+        }else {
109 109
             $this->castValue($key, $value, $type);
110 110
         }
111 111
     }
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
      * @return mixed
173 173
      */
174 174
     protected function checkCastedValue($rawValue, $type) {
175
-        if(null !== $rawValue) {
175
+        if (null !== $rawValue) {
176 176
             switch ($type) {
177 177
                 default:
178 178
                 case 'string':
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
                     $value = (bool)$rawValue;
192 192
                     break;
193 193
             }
194
-        } else {
194
+        }else {
195 195
             $value = $rawValue;
196 196
         }
197 197
         return $value;
Please login to merge, or discard this patch.
src/base/types/CurlService.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
     {
88 88
         $headers = [];
89 89
         foreach ($this->getHeaders() as $key => $value) {
90
-            $headers[] = $key . ': ' . $value;
90
+            $headers[] = $key.': '.$value;
91 91
         }
92 92
         $headers[self::PSFS_TRACK_HEADER] = Logger::getUid();
93 93
         if (count($headers)) {
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
             case Request::VERB_GET:
118 118
                 if (!empty($this->params)) {
119 119
                     $sep = false === strpos($this->getUrl(), '?') ? '?' : '';
120
-                    $this->setUrl($this->getUrl() . $sep . http_build_query($this->getParams()), false);
120
+                    $this->setUrl($this->getUrl().$sep.http_build_query($this->getParams()), false);
121 121
                 }
122 122
                 break;
123 123
             case Request::VERB_POST:
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
         if ($this->isDebug() && is_resource($verbose)) {
150 150
             $this->dumpVerboseLogs($verbose);
151 151
         }
152
-        Logger::log($this->getUrl() . ' response: ', LOG_DEBUG, is_array($this->getRawResult()) ? $this->getRawResult() : [$this->getRawResult()]);
152
+        Logger::log($this->getUrl().' response: ', LOG_DEBUG, is_array($this->getRawResult()) ? $this->getRawResult() : [$this->getRawResult()]);
153 153
         $this->info = array_merge($this->info, curl_getinfo($this->con));
154 154
     }
155 155
 
Please login to merge, or discard this patch.
src/base/extension/AssetsNode.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -34,20 +34,20 @@
 block discarded – undo
34 34
         $scripts = $this->getNode("scripts");
35 35
 
36 36
         //Creamos el parser
37
-        $compiler->addDebugInfo($scripts)->write('$parser = new \\PSFS\\base\\extension\\AssetsParser(\'' . $this->type . '\')')
37
+        $compiler->addDebugInfo($scripts)->write('$parser = new \\PSFS\\base\\extension\\AssetsParser(\''.$this->type.'\')')
38 38
             ->raw(";\n");
39 39
 
40 40
         //Asociamos el hash
41
-        $compiler->write('$parser->setHash(\'' . $this->hash . '\')')
41
+        $compiler->write('$parser->setHash(\''.$this->hash.'\')')
42 42
             ->raw(";\n");
43 43
 
44 44
         //Inicializamos SRI
45
-        $compiler->write('$parser->init(\'' . $this->type . '\')')
45
+        $compiler->write('$parser->init(\''.$this->type.'\')')
46 46
             ->raw(";\n");
47 47
 
48 48
         //Asociamos los ficheros
49 49
         foreach ($scripts->getAttribute("value") as $value) {
50
-            $compiler->write('$parser->addFile(\'' . $value . '\')')->raw(";\n");
50
+            $compiler->write('$parser->addFile(\''.$value.'\')')->raw(";\n");
51 51
         }
52 52
 
53 53
         //Procesamos los ficheros
Please login to merge, or discard this patch.
src/base/extension/AssetsParser.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -13,8 +13,8 @@  discard block
 block discarded – undo
13 13
 use PSFS\base\types\helpers\GeneratorHelper;
14 14
 use PSFS\base\types\helpers\Inspector;
15 15
 
16
-defined('CSS_SRI_FILENAME') or define('CSS_SRI_FILENAME', CACHE_DIR . DIRECTORY_SEPARATOR . 'css.sri.json');
17
-defined('JS_SRI_FILENAME') or define('JS_SRI_FILENAME', CACHE_DIR . DIRECTORY_SEPARATOR . 'js.sri.json');
16
+defined('CSS_SRI_FILENAME') or define('CSS_SRI_FILENAME', CACHE_DIR.DIRECTORY_SEPARATOR.'css.sri.json');
17
+defined('JS_SRI_FILENAME') or define('JS_SRI_FILENAME', CACHE_DIR.DIRECTORY_SEPARATOR.'js.sri.json');
18 18
 /**
19 19
  * Class AssetsParser
20 20
  * @package PSFS\base\extension
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
         /** @var Cache $cache */
67 67
         $cache = Cache::getInstance();
68 68
         $this->sri = $cache->getDataFromFile($this->sriFilename, Cache::JSON, true);
69
-        if(empty($this->sri)) {
69
+        if (empty($this->sri)) {
70 70
             $this->sri = [];
71 71
         }
72 72
     }
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
     public function __construct($type = 'js')
80 80
     {
81 81
         $this->type = $type;
82
-        $this->path = WEB_DIR . DIRECTORY_SEPARATOR;
82
+        $this->path = WEB_DIR.DIRECTORY_SEPARATOR;
83 83
         $this->domains = Template::getDomains(true);
84 84
         $this->cdnPath = Config::getParam('resources.cdn.url', Request::getInstance()->getRootUrl());
85 85
     }
@@ -92,12 +92,12 @@  discard block
 block discarded – undo
92 92
      */
93 93
     public function addFile($filename)
94 94
     {
95
-        if (file_exists($this->path . $filename) && preg_match('/\.' . $this->type . '$/i', $filename)) {
95
+        if (file_exists($this->path.$filename) && preg_match('/\.'.$this->type.'$/i', $filename)) {
96 96
             $this->files[] = $filename;
97 97
         } elseif (!empty($this->domains)) {
98 98
             foreach ($this->domains as $domain => $paths) {
99 99
                 $domainFilename = str_replace($domain, $paths["public"], $filename);
100
-                if (file_exists($domainFilename) && preg_match('/\.' . $this->type . '$/i', $domainFilename)) {
100
+                if (file_exists($domainFilename) && preg_match('/\.'.$this->type.'$/i', $domainFilename)) {
101 101
                     $this->files[] = $domainFilename;
102 102
                 }
103 103
             }
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
     public function setHash($hash)
115 115
     {
116 116
         $cache = Config::getParam('cache.var', '');
117
-        $this->hash = $hash . (strlen($cache) ? '.' : '') . $cache;
117
+        $this->hash = $hash.(strlen($cache) ? '.' : '').$cache;
118 118
         return $this;
119 119
     }
120 120
 
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
             $sourceFile = explode("?", $sourceFile);
178 178
             $sourceFile = $sourceFile[0];
179 179
         }
180
-        $orig = realpath(dirname($filenamePath) . DIRECTORY_SEPARATOR . $sourceFile);
180
+        $orig = realpath(dirname($filenamePath).DIRECTORY_SEPARATOR.$sourceFile);
181 181
         return $orig;
182 182
     }
183 183
 
@@ -194,15 +194,15 @@  discard block
 block discarded – undo
194 194
         if (preg_match_all('#url\((.*?)\)#', $line, $urls, PREG_SET_ORDER)) {
195 195
             foreach ($urls as $source) {
196 196
                 $orig = self::calculateResourcePathname($filenamePath, $source);
197
-                if(!empty($orig)) {
197
+                if (!empty($orig)) {
198 198
                     $orig_part = preg_split("/Public/i", $orig);
199
-                    $dest = WEB_DIR . $orig_part[1];
199
+                    $dest = WEB_DIR.$orig_part[1];
200 200
                     GeneratorHelper::createDir(dirname($dest));
201 201
                     if (@copy($orig, $dest) === false) {
202
-                        throw new ConfigException("Can't copy " . $orig . " to " . $dest);
202
+                        throw new ConfigException("Can't copy ".$orig." to ".$dest);
203 203
                     }
204
-                } else {
205
-                    Logger::log($filenamePath . ' has an empty origin with the url ' . $source, LOG_WARNING);
204
+                }else {
205
+                    Logger::log($filenamePath.' has an empty origin with the url '.$source, LOG_WARNING);
206 206
                 }
207 207
             }
208 208
         }
@@ -215,11 +215,11 @@  discard block
 block discarded – undo
215 215
      * @throws \PSFS\base\exception\GeneratorException
216 216
      */
217 217
     protected function getSriHash($hash, $type = 'js') {
218
-        if(array_key_exists($hash, $this->sri)) {
218
+        if (array_key_exists($hash, $this->sri)) {
219 219
             $sriHash = $this->sri[$hash];
220
-        } else {
221
-            Inspector::stats('[SRITrait] Generating SRI for ' . $hash, Inspector::SCOPE_DEBUG);
222
-            $filename = WEB_DIR . DIRECTORY_SEPARATOR . $type . DIRECTORY_SEPARATOR . $hash . '.' . $type;
220
+        }else {
221
+            Inspector::stats('[SRITrait] Generating SRI for '.$hash, Inspector::SCOPE_DEBUG);
222
+            $filename = WEB_DIR.DIRECTORY_SEPARATOR.$type.DIRECTORY_SEPARATOR.$hash.'.'.$type;
223 223
             $sriHash = base64_encode(hash("sha384", file_get_contents($filename), true));
224 224
             $this->sri[$hash] = $sriHash;
225 225
             Cache::getInstance()->storeData($this->sriFilename, $this->sri, Cache::JSON, true);
Please login to merge, or discard this patch.