Test Failed
Push — master ( cc821f...fdc4d2 )
by Fran
09:36 queued 04:02
created
src/Dispatcher.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -73,18 +73,18 @@
 block discarded – undo
73 73
                 if (!Request::getInstance()->isFile()) {
74 74
                     return $this->router->execute($this->actualUri);
75 75
                 }
76
-            } else {
76
+            }else {
77 77
                 return ConfigController::getInstance()->config();
78 78
             }
79
-        } catch (AdminCredentialsException $a) {
79
+        }catch (AdminCredentialsException $a) {
80 80
             return UserController::showAdminManager();
81
-        } catch (SecurityException $s) {
81
+        }catch (SecurityException $s) {
82 82
             return $this->security->notAuthorized($this->actualUri);
83
-        } catch (RouterException $r) {
83
+        }catch (RouterException $r) {
84 84
             return $this->router->httpNotFound($r);
85
-        } catch(ApiException $a) {
85
+        }catch (ApiException $a) {
86 86
             return $this->router->httpNotFound($a, true);
87
-        } catch (\Exception $e) {
87
+        }catch (\Exception $e) {
88 88
             return $this->dumpException($e);
89 89
         }
90 90
     }
Please login to merge, or discard this patch.
src/base/dto/Dto.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
     public function __construct($hydrate = true)
19 19
     {
20 20
         parent::__construct();
21
-        if($hydrate) {
21
+        if ($hydrate) {
22 22
             $this->fromArray(Request::getInstance()->getData());
23 23
         }
24 24
     }
@@ -46,15 +46,15 @@  discard block
 block discarded – undo
46 46
                 /** @var \ReflectionProperty $property */
47 47
                 foreach ($properties as $property) {
48 48
                     $value = $property->getValue($this);
49
-                    if(is_object($value) && method_exists($value, 'toArray')) {
49
+                    if (is_object($value) && method_exists($value, 'toArray')) {
50 50
                         $dto[$property->getName()] = $value->toArray();
51
-                    } else {
51
+                    }else {
52 52
                         $dto[$property->getName()] = $property->getValue($this);
53 53
                     }
54 54
                 }
55 55
             }
56
-        } catch (\Exception $e) {
57
-            Logger::log(get_class($this) . ': ' . $e->getMessage(), LOG_ERR);
56
+        }catch (\Exception $e) {
57
+            Logger::log(get_class($this).': '.$e->getMessage(), LOG_ERR);
58 58
         }
59 59
         return $dto;
60 60
     }
@@ -76,32 +76,32 @@  discard block
 block discarded – undo
76 76
     protected function parseDtoField(array $properties, $key, $value = null) {
77 77
         $type = 'string';
78 78
         $is_array = false;
79
-        if(array_key_exists($key, $properties)) {
79
+        if (array_key_exists($key, $properties)) {
80 80
             $type = $properties[$key];
81
-            if(preg_match('/(\[\]|Array)/i', $type)) {
81
+            if (preg_match('/(\[\]|Array)/i', $type)) {
82 82
                 $type = preg_replace('/(\[\]|Array)/i', '', $type);
83 83
                 $is_array = true;
84 84
             }
85 85
         }
86 86
         $reflector = (class_exists($type)) ? new \ReflectionClass($type) : null;
87
-        if(null !== $reflector && $reflector->isSubclassOf(Dto::class)) {
88
-            if(null !== $value && is_array($value)) {
89
-                if($is_array) {
87
+        if (null !== $reflector && $reflector->isSubclassOf(Dto::class)) {
88
+            if (null !== $value && is_array($value)) {
89
+                if ($is_array) {
90 90
                     $this->$key = [];
91
-                    foreach($value as $data) {
92
-                        if(null !== $data && is_array($data)) {
91
+                    foreach ($value as $data) {
92
+                        if (null !== $data && is_array($data)) {
93 93
                             $dto = new $type(false);
94 94
                             $dto->fromArray($data);
95 95
                             array_push($this->$key, $dto);
96 96
                         }
97 97
                     }
98
-                } else {
98
+                }else {
99 99
                     $this->$key = new $type(false);
100 100
                     $this->$key->fromArray($value);
101 101
                 }
102 102
             }
103
-        } else {
104
-            switch($type) {
103
+        }else {
104
+            switch ($type) {
105 105
                 default:
106 106
                 case 'string':
107 107
                     $this->$key = $value;
Please login to merge, or discard this patch.
src/base/types/helpers/SecurityHelper.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
         if (!Config::getInstance()->checkTryToSaveConfig()
30 30
             && (preg_match('/^\/(admin|setup\-admin)/i', $route) || Config::getParam('restricted', false))
31 31
         ) {
32
-            if (null === Cache::getInstance()->getDataFromFile(CONFIG_DIR . DIRECTORY_SEPARATOR . 'admins.json', Cache::JSONGZ, true)) {
32
+            if (null === Cache::getInstance()->getDataFromFile(CONFIG_DIR.DIRECTORY_SEPARATOR.'admins.json', Cache::JSONGZ, true)) {
33 33
                 throw new AdminCredentialsException();
34 34
             }
35 35
             if (!Security::getInstance()->checkAdmin()) {
@@ -49,8 +49,8 @@  discard block
 block discarded – undo
49 49
         $token = '';
50 50
         $ct = strlen($ts);
51 51
         for ($i = 0; $i < $ct; $i++) {
52
-            $token = substr($hash, $i, 1) .
53
-                    substr($ts, $i, 1) .
52
+            $token = substr($hash, $i, 1).
53
+                    substr($ts, $i, 1).
54 54
                     $token;
55 55
         }
56 56
         return $token;
@@ -68,16 +68,16 @@  discard block
 block discarded – undo
68 68
         $charsLength = strlen(self::RAND_SEP) - 1;
69 69
         $tsLength = strlen($ts);
70 70
         $i = 0;
71
-        $ct = ceil($hashRest / 4);
72
-        $part = substr($hash, $tsLength + $ct * $i, $ct);
73
-        while(false !== $part) {
74
-            $mixedToken .= $part .
75
-                substr(self::RAND_SEP, round(rand(0, $charsLength), 0, PHP_ROUND_HALF_DOWN), 1) .
71
+        $ct = ceil($hashRest/4);
72
+        $part = substr($hash, $tsLength + $ct*$i, $ct);
73
+        while (false !== $part) {
74
+            $mixedToken .= $part.
75
+                substr(self::RAND_SEP, round(rand(0, $charsLength), 0, PHP_ROUND_HALF_DOWN), 1).
76 76
                 substr(self::RAND_SEP, round(rand(0, $charsLength), 0, PHP_ROUND_HALF_DOWN), 1);
77
-            $part = substr($hash, $tsLength + $ct * $i, $ct);
77
+            $part = substr($hash, $tsLength + $ct*$i, $ct);
78 78
             $i++;
79 79
         }
80
-        return $mixedToken . $token;
80
+        return $mixedToken.$token;
81 81
     }
82 82
 
83 83
     /**
@@ -86,10 +86,10 @@  discard block
 block discarded – undo
86 86
      */
87 87
     private static function getTs($isOdd = null) {
88 88
         $ts = time();
89
-        $tsIsOdd = (bool)((int)substr($ts, -1) % 2);
90
-        if(false === $isOdd && !$tsIsOdd) {
89
+        $tsIsOdd = (bool)((int)substr($ts, -1)%2);
90
+        if (false === $isOdd && !$tsIsOdd) {
91 91
             $ts--;
92
-        } elseif(true === $isOdd && !$tsIsOdd) {
92
+        } elseif (true === $isOdd && !$tsIsOdd) {
93 93
             $ts--;
94 94
         }
95 95
         return $ts;
@@ -121,10 +121,10 @@  discard block
 block discarded – undo
121 121
         $partToken = '';
122 122
         $ts = '';
123 123
         $part = strrev($part);
124
-        for($i = 0, $ct = strlen($part); $i < $ct; $i++) {
125
-            if($i % 2 == 0) {
124
+        for ($i = 0, $ct = strlen($part); $i < $ct; $i++) {
125
+            if ($i%2 == 0) {
126 126
                 $ts .= substr($part, $i, 1);
127
-            } else {
127
+            }else {
128 128
                 $partToken .= substr($part, $i, 1);
129 129
             }
130 130
         }
@@ -139,11 +139,11 @@  discard block
 block discarded – undo
139 139
     private static function parseTokenParts(array $parts) {
140 140
         $token = '';
141 141
         list($partToken, $ts) = self::extractTs(array_pop($parts));
142
-        if($ts > 0) {
143
-            foreach($parts as $part) {
142
+        if ($ts > 0) {
143
+            foreach ($parts as $part) {
144 144
                 $token .= $part;
145 145
             }
146
-            $token = $partToken . $token;
146
+            $token = $partToken.$token;
147 147
         }
148 148
         return [$token, $ts];
149 149
     }
@@ -171,8 +171,8 @@  discard block
 block discarded – undo
171 171
      * @return array
172 172
      */
173 173
     private static function extractTokenParts($token) {
174
-        for($i = 0, $ct = strlen(self::RAND_SEP); $i < $ct; $i++) {
175
-            $token = str_replace(substr(self::RAND_SEP,$i,1), "|", $token);
174
+        for ($i = 0, $ct = strlen(self::RAND_SEP); $i < $ct; $i++) {
175
+            $token = str_replace(substr(self::RAND_SEP, $i, 1), "|", $token);
176 176
         }
177 177
         return array_unique(explode('||', $token));
178 178
     }
Please login to merge, or discard this patch.
src/base/types/Api.php 2 patches
Unused Use Statements   -7 removed lines patch added patch discarded remove patch
@@ -1,13 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 namespace PSFS\base\types;
3 3
 
4
-use CORE\Models\Customer;
5 4
 use CORE\Models\Map\CustomerTableMap;
6 5
 use Propel\Runtime\ActiveQuery\ModelCriteria;
7
-use Propel\Runtime\ActiveRecord\ActiveRecordInterface;
8
-use Propel\Runtime\DataFetcher\ArrayDataFetcher;
9
-use Propel\Runtime\Formatter\ObjectFormatter;
10
-use Propel\Runtime\Map\ColumnMap;
11 6
 use Propel\Runtime\Map\TableMap;
12 7
 use Propel\Runtime\Propel;
13 8
 use PSFS\base\config\Config;
@@ -15,10 +10,8 @@  discard block
 block discarded – undo
15 10
 use PSFS\base\dto\Order;
16 11
 use PSFS\base\Logger;
17 12
 use PSFS\base\Request;
18
-use PSFS\base\Security;
19 13
 use PSFS\base\Singleton;
20 14
 use PSFS\base\types\helpers\ApiHelper;
21
-use PSFS\base\types\helpers\Inspector;
22 15
 use PSFS\base\types\traits\Api\ManagerTrait;
23 16
 
24 17
 /**
Please login to merge, or discard this patch.
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -80,15 +80,15 @@  discard block
 block discarded – undo
80 80
     public function init()
81 81
     {
82 82
         parent::init();
83
-        Logger::log(get_called_class() . ' init', LOG_DEBUG);
83
+        Logger::log(get_called_class().' init', LOG_DEBUG);
84 84
         $this->domain = $this->getDomain();
85 85
         $this->hydrateRequestData();
86 86
         $this->hydrateOrders();
87
-        if($this instanceof CustomApi === false) {
87
+        if ($this instanceof CustomApi === false) {
88 88
             $this->createConnection($this->getTableMap());
89 89
         }
90 90
         $this->setLoaded(true);
91
-        Logger::log(get_called_class() . ' loaded', LOG_DEBUG);
91
+        Logger::log(get_called_class().' loaded', LOG_DEBUG);
92 92
     }
93 93
 
94 94
     /**
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
     protected function hydrateOrders()
98 98
     {
99 99
         if (count($this->query)) {
100
-            Logger::log(get_called_class() . ' gathering query string', LOG_DEBUG);
100
+            Logger::log(get_called_class().' gathering query string', LOG_DEBUG);
101 101
             foreach ($this->query as $key => $value) {
102 102
                 if ($key === self::API_ORDER_FIELD && is_array($value)) {
103 103
                     foreach ($value as $field => $direction) {
@@ -114,10 +114,10 @@  discard block
 block discarded – undo
114 114
      */
115 115
     protected function extractPagination()
116 116
     {
117
-        Logger::log(get_called_class() . ' extract pagination start', LOG_DEBUG);
117
+        Logger::log(get_called_class().' extract pagination start', LOG_DEBUG);
118 118
         $page = (array_key_exists(self::API_PAGE_FIELD, $this->query)) ? $this->query[self::API_PAGE_FIELD] : 1;
119 119
         $limit = (array_key_exists(self::API_LIMIT_FIELD, $this->query)) ? $this->query[self::API_LIMIT_FIELD] : 100;
120
-        Logger::log(get_called_class() . ' extract pagination end', LOG_DEBUG);
120
+        Logger::log(get_called_class().' extract pagination end', LOG_DEBUG);
121 121
         return array($page, $limit);
122 122
     }
123 123
 
@@ -126,9 +126,9 @@  discard block
 block discarded – undo
126 126
      *
127 127
      * @param ModelCriteria $query
128 128
      */
129
-    private function addOrders(ModelCriteria &$query)
129
+    private function addOrders(ModelCriteria & $query)
130 130
     {
131
-        Logger::log(get_called_class() . ' extract orders start ', LOG_DEBUG);
131
+        Logger::log(get_called_class().' extract orders start ', LOG_DEBUG);
132 132
         $orderAdded = FALSE;
133 133
         $tableMap = $this->getTableMap();
134 134
         foreach ($this->order->getOrders() as $field => $direction) {
@@ -136,17 +136,17 @@  discard block
 block discarded – undo
136 136
                 $orderAdded = TRUE;
137 137
                 if ($direction === Order::ASC) {
138 138
                     $query->addAscendingOrderByColumn($column->getPhpName());
139
-                } else {
139
+                }else {
140 140
                     $query->addDescendingOrderByColumn($column->getPhpName());
141 141
                 }
142 142
             }
143 143
         }
144 144
         if (!$orderAdded) {
145
-            foreach($this->getPkDbName() as $pk => $phpName) {
145
+            foreach ($this->getPkDbName() as $pk => $phpName) {
146 146
                 $query->addAscendingOrderByColumn($pk);
147 147
             }
148 148
         }
149
-        Logger::log(get_called_class() . ' extract orders end', LOG_DEBUG);
149
+        Logger::log(get_called_class().' extract orders end', LOG_DEBUG);
150 150
     }
151 151
 
152 152
     /**
@@ -154,14 +154,14 @@  discard block
 block discarded – undo
154 154
      *
155 155
      * @param ModelCriteria $query
156 156
      */
157
-    protected function addFilters(ModelCriteria &$query)
157
+    protected function addFilters(ModelCriteria & $query)
158 158
     {
159 159
         if (count($this->query) > 0) {
160 160
             $tableMap = $this->getTableMap();
161 161
             foreach ($this->query as $field => $value) {
162 162
                 if (self::API_COMBO_FIELD === $field) {
163 163
                     ApiHelper::composerComboField($tableMap, $query, $this->extraColumns, $value);
164
-                } elseif(!preg_match('/^__/', $field)) {
164
+                } elseif (!preg_match('/^__/', $field)) {
165 165
                     ApiHelper::addModelField($tableMap, $query, $field, $value);
166 166
                 }
167 167
             }
@@ -182,10 +182,10 @@  discard block
 block discarded – undo
182 182
             list($page, $limit) = $this->extractPagination();
183 183
             if ($limit == -1) {
184 184
                 $this->list = $query->find($this->con);
185
-            } else {
185
+            }else {
186 186
                 $this->list = $query->paginate($page, $limit, $this->con);
187 187
             }
188
-        } catch (\Exception $e) {
188
+        }catch (\Exception $e) {
189 189
             Logger::log($e->getMessage(), LOG_ERR);
190 190
         }
191 191
     }
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
         $code = 200;
205 205
         list($return, $total, $pages) = $this->getList();
206 206
         $message = null;
207
-        if(!$total) {
207
+        if (!$total) {
208 208
             $message = _('No se han encontrado elementos para la búsqueda');
209 209
         }
210 210
 
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
         $pages = 1;
231 231
         $message = null;
232 232
         list($code, $return) = $this->getSingleResult($pk);
233
-        if($code !== 200) {
233
+        if ($code !== 200) {
234 234
             $message = _('No se ha encontrado el elemento solicitado');
235 235
         }
236 236
 
@@ -259,11 +259,11 @@  discard block
 block discarded – undo
259 259
                 $status = 200;
260 260
                 $saved = TRUE;
261 261
                 $model = $this->model->toArray();
262
-            } else {
262
+            }else {
263 263
                 $message = _('No se ha podido guardar el modelo seleccionado');
264 264
             }
265
-        } catch (\Exception $e) {
266
-            $message = _('Ha ocurrido un error intentando guardar el elemento: ') .'<br>'. $e->getMessage();
265
+        }catch (\Exception $e) {
266
+            $message = _('Ha ocurrido un error intentando guardar el elemento: ').'<br>'.$e->getMessage();
267 267
             Logger::log($e->getMessage(), LOG_ERR);
268 268
         }
269 269
 
@@ -297,14 +297,14 @@  discard block
 block discarded – undo
297 297
                     $updated = TRUE;
298 298
                     $status = 200;
299 299
                     $model = $this->model->toArray();
300
-                } else {
300
+                }else {
301 301
                     $message = _('Ha ocurrido un error intentando actualizar el elemento, por favor revisa los logs');
302 302
                 }
303
-            } catch (\Exception $e) {
303
+            }catch (\Exception $e) {
304 304
                 $message = $e->getMessage();
305 305
                 Logger::getInstance(get_class($this->model))->errorLog($e->getMessage());
306 306
             }
307
-        } else {
307
+        }else {
308 308
             $message = _('No se ha encontrado el modelo al que se hace referencia para actualizar');
309 309
         }
310 310
 
@@ -332,13 +332,13 @@  discard block
 block discarded – undo
332 332
                 $this->con->beginTransaction();
333 333
                 $this->hydrateModel($pk);
334 334
                 if (NULL !== $this->model) {
335
-                    if(method_exists('clearAllReferences', $this->model)) {
335
+                    if (method_exists('clearAllReferences', $this->model)) {
336 336
                         $this->model->clearAllReferences(true);
337 337
                     }
338 338
                     $this->model->delete($this->con);
339 339
                     $deleted = TRUE;
340 340
                 }
341
-            } catch (\Exception $e) {
341
+            }catch (\Exception $e) {
342 342
                 $message = _('Ha ocurrido un error intentando eliminar el elemento, por favor verifica que no tenga otros elementos relacionados');
343 343
                 Logger::getInstance(get_class($this->model))->errorLog($e->getMessage());
344 344
             }
@@ -366,7 +366,7 @@  discard block
 block discarded – undo
366 366
             $this->saveBulk();
367 367
             $saved = true;
368 368
             $status = 200;
369
-        } catch(\Exception $e) {
369
+        }catch (\Exception $e) {
370 370
             Logger::log($e->getMessage(), LOG_ERR, $this->getRequest()->getData());
371 371
             $message = _('Bulk insert rolled back');
372 372
         }
@@ -388,7 +388,7 @@  discard block
 block discarded – undo
388 388
 
389 389
         /** @var CustomerTableMap $tableMap */
390 390
         $modelPk = ApiHelper::extractPrimaryKeyColumnName($this->getTableMap());
391
-        foreach($this->list->getData() as $data) {
391
+        foreach ($this->list->getData() as $data) {
392 392
             $return[] = ApiHelper::mapArrayObject($this->getModelNamespace(), $modelPk, $this->query, $data);
393 393
         }
394 394
         return $return;
@@ -405,20 +405,20 @@  discard block
 block discarded – undo
405 405
         try {
406 406
             $this->paginate();
407 407
             if (null !== $this->list) {
408
-                if(array_key_exists(self::API_FIELDS_RESULT_FIELD, $this->query) && Config::getParam('api.field.types')) {
408
+                if (array_key_exists(self::API_FIELDS_RESULT_FIELD, $this->query) && Config::getParam('api.field.types')) {
409 409
                     $return = $this->extractDataWithFormat();
410
-                } else {
410
+                }else {
411 411
                     $return = $this->list->toArray(null, false, TableMap::TYPE_PHPNAME, false);
412 412
                 }
413 413
                 $total = 0;
414 414
                 $pages = 0;
415
-                if(null !== $this->list) {
415
+                if (null !== $this->list) {
416 416
                     $total = $this->list->getNbResults();
417 417
                     $pages = $this->list->getLastPage();
418 418
                 }
419 419
             }
420
-        } catch (\Exception $e) {
421
-            Logger::log(get_class($this) . ': ' . $e->getMessage(), LOG_ERR);
420
+        }catch (\Exception $e) {
421
+            Logger::log(get_class($this).': '.$e->getMessage(), LOG_ERR);
422 422
         }
423 423
 
424 424
         return array($return, $total, $pages);
@@ -436,7 +436,7 @@  discard block
 block discarded – undo
436 436
         $return = array();
437 437
         if (NULL === $model || !method_exists($model, 'toArray')) {
438 438
             $code = 404;
439
-        } else {
439
+        }else {
440 440
             $return = $model->toArray();
441 441
         }
442 442
 
Please login to merge, or discard this patch.
src/base/Cache.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -188,7 +188,7 @@
 block discarded – undo
188 188
     }
189 189
 
190 190
     /**
191
-     * @return integer|boolean
191
+     * @return integer
192 192
      */
193 193
     public static function needCache()
194 194
     {
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
     {
55 55
         GeneratorHelper::createDir(dirname($path));
56 56
         if (false === FileHelper::writeFile($path, $data)) {
57
-            throw new ConfigException(_('No se tienen los permisos suficientes para escribir en el fichero ') . $path);
57
+            throw new ConfigException(_('No se tienen los permisos suficientes para escribir en el fichero ').$path);
58 58
         }
59 59
     }
60 60
 
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
     {
69 69
         Logger::log('Gathering data from cache', LOG_DEBUG, ['path' => $path]);
70 70
         $data = null;
71
-        $absolutePath = $absolute ? $path : CACHE_DIR . DIRECTORY_SEPARATOR . $path;
71
+        $absolutePath = $absolute ? $path : CACHE_DIR.DIRECTORY_SEPARATOR.$path;
72 72
         if (file_exists($absolutePath)) {
73 73
             $data = FileHelper::readFile($absolutePath);
74 74
         }
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
     private function hasExpiredCache($path, $expires = 300, $absolute = false)
85 85
     {
86 86
         Logger::log('Checking expiration', LOG_DEBUG, ['path' => $path]);
87
-        $absolutePath = ($absolute) ? $path : CACHE_DIR . DIRECTORY_SEPARATOR . $path;
87
+        $absolutePath = ($absolute) ? $path : CACHE_DIR.DIRECTORY_SEPARATOR.$path;
88 88
         $lasModificationDate = filemtime($absolutePath);
89 89
         return ($lasModificationDate + $expires <= time());
90 90
     }
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
     {
152 152
         Logger::log('Store data in cache', LOG_DEBUG, ['path' => $path]);
153 153
         $data = self::transformData($data, $transform);
154
-        $absolutePath = $absolute ? $path : CACHE_DIR . DIRECTORY_SEPARATOR . $path;
154
+        $absolutePath = $absolute ? $path : CACHE_DIR.DIRECTORY_SEPARATOR.$path;
155 155
         $this->saveTextToFile($data, $absolutePath);
156 156
     }
157 157
 
@@ -168,11 +168,11 @@  discard block
 block discarded – undo
168 168
     {
169 169
         $data = null;
170 170
         Logger::log('Reading data from cache', LOG_DEBUG, ['path' => $path]);
171
-        if (file_exists(CACHE_DIR . DIRECTORY_SEPARATOR . $path)) {
171
+        if (file_exists(CACHE_DIR.DIRECTORY_SEPARATOR.$path)) {
172 172
             if (is_callable($function) && $this->hasExpiredCache($path, $expires)) {
173 173
                 $data = $function();
174 174
                 $this->storeData($path, $data, $transform, false, $expires);
175
-            } else {
175
+            }else {
176 176
                 $data = $this->getDataFromFile($path, $transform);
177 177
             }
178 178
         }
@@ -224,13 +224,13 @@  discard block
 block discarded – undo
224 224
     }
225 225
 
226 226
     public function flushCache() {
227
-        if(Config::getParam('cache.data.enable', false)) {
227
+        if (Config::getParam('cache.data.enable', false)) {
228 228
             Logger::log('Flushing cache', LOG_DEBUG);
229 229
             $action = Security::getInstance()->getSessionKey(self::CACHE_SESSION_VAR);
230
-            if(is_array($action)) {
231
-                $hashPath = FileHelper::generateCachePath($action, $action['params']) . '..' . DIRECTORY_SEPARATOR . ' .. ' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR;
232
-                if(!file_exists($hashPath)) {
233
-                    $hashPath = CACHE_DIR . DIRECTORY_SEPARATOR . $hashPath;
230
+            if (is_array($action)) {
231
+                $hashPath = FileHelper::generateCachePath($action, $action['params']).'..'.DIRECTORY_SEPARATOR.' .. '.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR;
232
+                if (!file_exists($hashPath)) {
233
+                    $hashPath = CACHE_DIR.DIRECTORY_SEPARATOR.$hashPath;
234 234
                 }
235 235
                 FileHelper::deleteDir($hashPath);
236 236
             }
Please login to merge, or discard this patch.
src/base/Logger.php 2 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
      * @param string $msg
86 86
      * @param array $context
87 87
      *
88
-     * @return bool
88
+     * @return boolean|null
89 89
      */
90 90
     public function debugLog($msg = '', array $context = [])
91 91
     {
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
     }
94 94
 
95 95
     /**
96
-     * @param $msg
96
+     * @param string $msg
97 97
      * @param array $context
98 98
      *
99 99
      * @return bool
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
     }
105 105
 
106 106
     /**
107
-     * @param $msg
107
+     * @param string $msg
108 108
      * @param array $context
109 109
      * @return bool
110 110
      */
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -15,8 +15,8 @@  discard block
 block discarded – undo
15 15
 
16 16
 
17 17
 if (!defined('LOG_DIR')) {
18
-    GeneratorHelper::createDir(BASE_DIR . DIRECTORY_SEPARATOR . 'logs');
19
-    define('LOG_DIR', BASE_DIR . DIRECTORY_SEPARATOR . 'logs');
18
+    GeneratorHelper::createDir(BASE_DIR.DIRECTORY_SEPARATOR.'logs');
19
+    define('LOG_DIR', BASE_DIR.DIRECTORY_SEPARATOR.'logs');
20 20
 }
21 21
 
22 22
 /**
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
         $config = Config::getInstance();
51 51
         $args = func_get_args();
52 52
         list($logger, $debug, $path) = $this->setup($config, $args);
53
-        $this->stream = fopen($path . DIRECTORY_SEPARATOR . date('Ymd') . '.log', 'a+');
53
+        $this->stream = fopen($path.DIRECTORY_SEPARATOR.date('Ymd').'.log', 'a+');
54 54
         $this->addPushLogger($logger, $debug, $config);
55 55
         $this->log_level = Config::getParam('log.level', 'info');
56 56
     }
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
     private function createLoggerPath(Config $config)
192 192
     {
193 193
         $logger = $this->setLoggerName($config);
194
-        $path = LOG_DIR . DIRECTORY_SEPARATOR . $logger . DIRECTORY_SEPARATOR . date('Y') . DIRECTORY_SEPARATOR . date('m');
194
+        $path = LOG_DIR.DIRECTORY_SEPARATOR.$logger.DIRECTORY_SEPARATOR.date('Y').DIRECTORY_SEPARATOR.date('m');
195 195
         GeneratorHelper::createDir($path);
196 196
 
197 197
         return $path;
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
      */
205 205
     public static function log($msg, $type = LOG_DEBUG, array $context = [])
206 206
     {
207
-        if(Config::getParam('profiling.enable')) {
207
+        if (Config::getParam('profiling.enable')) {
208 208
             Inspector::stats($msg);
209 209
         }
210 210
         switch ($type) {
Please login to merge, or discard this patch.
src/base/Router.php 2 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
     }
180 180
 
181 181
     /**
182
-     * @param $route
182
+     * @param string|null $route
183 183
      * @throws AccessDeniedException
184 184
      * @throws AdminCredentialsException
185 185
      * @throws RouterException
@@ -535,7 +535,7 @@  discard block
 block discarded – undo
535 535
     /**
536 536
      * @param bool $hydrateRoute
537 537
      * @param $modulePath
538
-     * @param $externalModulePath
538
+     * @param string $externalModulePath
539 539
      */
540 540
     private function loadExternalAutoloader($hydrateRoute, SplFileInfo $modulePath, $externalModulePath)
541 541
     {
@@ -550,7 +550,7 @@  discard block
 block discarded – undo
550 550
     }
551 551
 
552 552
     /**
553
-     * @param $hydrateRoute
553
+     * @param boolean $hydrateRoute
554 554
      * @param $module
555 555
      * @return mixed
556 556
      */
Please login to merge, or discard this patch.
Spacing   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -71,11 +71,11 @@  discard block
 block discarded – undo
71 71
      */
72 72
     public function init()
73 73
     {
74
-        list($this->routing, $this->slugs) = $this->cache->getDataFromFile(CONFIG_DIR . DIRECTORY_SEPARATOR . "urls.json", $this->cacheType, TRUE);
74
+        list($this->routing, $this->slugs) = $this->cache->getDataFromFile(CONFIG_DIR.DIRECTORY_SEPARATOR."urls.json", $this->cacheType, TRUE);
75 75
         if (empty($this->routing) || Config::getInstance()->getDebugMode()) {
76 76
             $this->debugLoad();
77
-        } else {
78
-            $this->domains = $this->cache->getDataFromFile(CONFIG_DIR . DIRECTORY_SEPARATOR . "domains.json", $this->cacheType, TRUE);
77
+        }else {
78
+            $this->domains = $this->cache->getDataFromFile(CONFIG_DIR.DIRECTORY_SEPARATOR."domains.json", $this->cacheType, TRUE);
79 79
         }
80 80
         $this->checkExternalModules(false);
81 81
         $this->setLoaded();
@@ -112,9 +112,9 @@  discard block
 block discarded – undo
112 112
         }
113 113
 
114 114
         $not_found_route = Config::getParam('route.404');
115
-        if(null !== $not_found_route) {
115
+        if (null !== $not_found_route) {
116 116
             Request::getInstance()->redirect($this->getRoute($not_found_route, true));
117
-        } else {
117
+        }else {
118 118
             return $template->render('error.html.twig', array(
119 119
                 'exception' => $e,
120 120
                 'trace' => $e->getTraceAsString(),
@@ -165,12 +165,12 @@  discard block
 block discarded – undo
165 165
         try {
166 166
             //Search action and execute
167 167
             $this->searchAction($route);
168
-        } catch (AccessDeniedException $e) {
169
-            Logger::log(_('Solicitamos credenciales de acceso a zona restringida'), LOG_WARNING, ['file' => $e->getFile() . '[' . $e->getLine() . ']']);
168
+        }catch (AccessDeniedException $e) {
169
+            Logger::log(_('Solicitamos credenciales de acceso a zona restringida'), LOG_WARNING, ['file' => $e->getFile().'['.$e->getLine().']']);
170 170
             return Admin::staticAdminLogon($route);
171
-        } catch (RouterException $r) {
171
+        }catch (RouterException $r) {
172 172
             Logger::log($r->getMessage(), LOG_WARNING);
173
-        } catch (\Exception $e) {
173
+        }catch (\Exception $e) {
174 174
             Logger::log($e->getMessage(), LOG_ERR);
175 175
             throw $e;
176 176
         }
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
      */
188 188
     protected function searchAction($route)
189 189
     {
190
-        Logger::log('Searching action to execute: ' . $route, LOG_INFO);
190
+        Logger::log('Searching action to execute: '.$route, LOG_INFO);
191 191
         //Revisamos si tenemos la ruta registrada
192 192
         $parts = parse_url($route);
193 193
         $path = array_key_exists('path', $parts) ? $parts['path'] : $route;
@@ -202,12 +202,12 @@  discard block
 block discarded – undo
202 202
                 /** @var $class \PSFS\base\types\Controller */
203 203
                 $class = RouterHelper::getClassToCall($action);
204 204
                 try {
205
-                    if($this->checkRequirements($action, $get)) {
205
+                    if ($this->checkRequirements($action, $get)) {
206 206
                         $this->executeCachedRoute($route, $action, $class, $get);
207
-                    } else {
207
+                    }else {
208 208
                         throw new RouterException(_('La ruta no es válida'), 400);
209 209
                     }
210
-                } catch (\Exception $e) {
210
+                }catch (\Exception $e) {
211 211
                     Logger::log($e->getMessage(), LOG_ERR);
212 212
                     throw $e;
213 213
                 }
@@ -222,15 +222,15 @@  discard block
 block discarded – undo
222 222
      * @return bool
223 223
      */
224 224
     private function checkRequirements(array $action, $params = []) {
225
-        if(!empty($params) && !empty($action['requirements'])) {
225
+        if (!empty($params) && !empty($action['requirements'])) {
226 226
             $checked = 0;
227
-            foreach(array_keys($params) as $key) {
228
-                if(in_array($key, $action['requirements'], true)) {
227
+            foreach (array_keys($params) as $key) {
228
+                if (in_array($key, $action['requirements'], true)) {
229 229
                     $checked++;
230 230
                 }
231 231
             }
232 232
             $valid = count($action['requirements']) === $checked;
233
-        } else {
233
+        }else {
234 234
             $valid = true;
235 235
         }
236 236
         return $valid;
@@ -280,14 +280,14 @@  discard block
 block discarded – undo
280 280
         $this->checkExternalModules();
281 281
         if (file_exists($modulesPath)) {
282 282
             $modules = $this->finder->directories()->in($modulesPath)->depth(0);
283
-            if(is_array($modules)) {
283
+            if (is_array($modules)) {
284 284
                 foreach ($modules as $modulePath) {
285 285
                     $module = $modulePath->getBasename();
286
-                    $this->routing = $this->inspectDir($modulesPath . DIRECTORY_SEPARATOR . $module, $module, $this->routing);
286
+                    $this->routing = $this->inspectDir($modulesPath.DIRECTORY_SEPARATOR.$module, $module, $this->routing);
287 287
                 }
288 288
             }
289 289
         }
290
-        $this->cache->storeData(CONFIG_DIR . DIRECTORY_SEPARATOR . 'domains.json', $this->domains, Cache::JSON, TRUE);
290
+        $this->cache->storeData(CONFIG_DIR.DIRECTORY_SEPARATOR.'domains.json', $this->domains, Cache::JSON, TRUE);
291 291
     }
292 292
 
293 293
     /**
@@ -303,7 +303,7 @@  discard block
 block discarded – undo
303 303
             $home_params = NULL;
304 304
             foreach ($this->routing as $pattern => $params) {
305 305
                 list($method, $route) = RouterHelper::extractHttpRoute($pattern);
306
-                if (preg_match('/' . preg_quote($route, '/') . '$/i', '/' . $home)) {
306
+                if (preg_match('/'.preg_quote($route, '/').'$/i', '/'.$home)) {
307 307
                     $home_params = $params;
308 308
                 }
309 309
             }
@@ -324,10 +324,10 @@  discard block
 block discarded – undo
324 324
     private function inspectDir($origen, $namespace = 'PSFS', $routing = [])
325 325
     {
326 326
         $files = $this->finder->files()->in($origen)->path('/(controller|api)/i')->depth(1)->name('*.php');
327
-        if(is_array($files)) {
327
+        if (is_array($files)) {
328 328
             foreach ($files as $file) {
329 329
                 $filename = str_replace('/', '\\', str_replace($origen, '', $file->getPathname()));
330
-                $routing = $this->addRouting($namespace . str_replace('.php', '', $filename), $routing, $namespace);
330
+                $routing = $this->addRouting($namespace.str_replace('.php', '', $filename), $routing, $namespace);
331 331
             }
332 332
         }
333 333
         $this->finder = new Finder();
@@ -356,7 +356,7 @@  discard block
 block discarded – undo
356 356
     private function addRouting($namespace, &$routing, $module = 'PSFS')
357 357
     {
358 358
         if (self::exists($namespace)) {
359
-            if(I18nHelper::checkI18Class($namespace)) {
359
+            if (I18nHelper::checkI18Class($namespace)) {
360 360
                 return $routing;
361 361
             }
362 362
             $reflection = new \ReflectionClass($namespace);
@@ -398,7 +398,7 @@  discard block
 block discarded – undo
398 398
             if (!$this->domains) {
399 399
                 $this->domains = [];
400 400
             }
401
-            $domain = '@' . $class->getConstant('DOMAIN') . '/';
401
+            $domain = '@'.$class->getConstant('DOMAIN').'/';
402 402
             if (!array_key_exists($domain, $this->domains)) {
403 403
                 $this->domains[$domain] = RouterHelper::extractDomainInfo($class, $domain);
404 404
             }
@@ -414,11 +414,11 @@  discard block
 block discarded – undo
414 414
      */
415 415
     public function simpatize()
416 416
     {
417
-        $translationFileName = 'translations' . DIRECTORY_SEPARATOR . 'routes_translations.php';
418
-        $absoluteTranslationFileName = CACHE_DIR . DIRECTORY_SEPARATOR . $translationFileName;
417
+        $translationFileName = 'translations'.DIRECTORY_SEPARATOR.'routes_translations.php';
418
+        $absoluteTranslationFileName = CACHE_DIR.DIRECTORY_SEPARATOR.$translationFileName;
419 419
         $this->generateSlugs($absoluteTranslationFileName);
420 420
         GeneratorHelper::createDir(CONFIG_DIR);
421
-        Cache::getInstance()->storeData(CONFIG_DIR . DIRECTORY_SEPARATOR . 'urls.json', array($this->routing, $this->slugs), Cache::JSON, TRUE);
421
+        Cache::getInstance()->storeData(CONFIG_DIR.DIRECTORY_SEPARATOR.'urls.json', array($this->routing, $this->slugs), Cache::JSON, TRUE);
422 422
 
423 423
         return $this;
424 424
     }
@@ -434,18 +434,18 @@  discard block
 block discarded – undo
434 434
     public function getRoute($slug = '', $absolute = FALSE, array $params = [])
435 435
     {
436 436
         if ('' === $slug) {
437
-            return $absolute ? Request::getInstance()->getRootUrl() . '/' : '/';
437
+            return $absolute ? Request::getInstance()->getRootUrl().'/' : '/';
438 438
         }
439 439
         if (!is_array($this->slugs) || !array_key_exists($slug, $this->slugs)) {
440 440
             throw new RouterException(_('No existe la ruta especificada'));
441 441
         }
442
-        $url = $absolute ? Request::getInstance()->getRootUrl() . $this->slugs[$slug] : $this->slugs[$slug];
442
+        $url = $absolute ? Request::getInstance()->getRootUrl().$this->slugs[$slug] : $this->slugs[$slug];
443 443
         if (!empty($params)) {
444 444
             foreach ($params as $key => $value) {
445
-                $url = str_replace('{' . $key . '}', $value, $url);
445
+                $url = str_replace('{'.$key.'}', $value, $url);
446 446
             }
447 447
         } elseif (!empty($this->routing[$this->slugs[$slug]]['default'])) {
448
-            $url = $absolute ? Request::getInstance()->getRootUrl() . $this->routing[$this->slugs[$slug]]['default'] : $this->routing[$this->slugs[$slug]]['default'];
448
+            $url = $absolute ? Request::getInstance()->getRootUrl().$this->routing[$this->slugs[$slug]]['default'] : $this->routing[$this->slugs[$slug]]['default'];
449 449
         }
450 450
 
451 451
         return preg_replace('/(GET|POST|PUT|DELETE|ALL)\#\|\#/', '', $url);
@@ -487,17 +487,17 @@  discard block
 block discarded – undo
487 487
      */
488 488
     protected function executeCachedRoute($route, $action, $class, $params = NULL)
489 489
     {
490
-        Logger::log('Executing route ' . $route, LOG_INFO);
490
+        Logger::log('Executing route '.$route, LOG_INFO);
491 491
         $action['params'] = array_merge($action['params'], $params, Request::getInstance()->getQueryParams());
492 492
         Security::getInstance()->setSessionKey(Cache::CACHE_SESSION_VAR, $action);
493 493
         $cache = Cache::needCache();
494 494
         $execute = TRUE;
495 495
         if (FALSE !== $cache && $action['http'] === 'GET' && Config::getParam('debug') === FALSE) {
496 496
             list($path, $cacheDataName) = $this->cache->getRequestCacheHash();
497
-            $cachedData = $this->cache->readFromCache('json' . DIRECTORY_SEPARATOR . $path . $cacheDataName,
497
+            $cachedData = $this->cache->readFromCache('json'.DIRECTORY_SEPARATOR.$path.$cacheDataName,
498 498
                 $cache);
499 499
             if (NULL !== $cachedData) {
500
-                $headers = $this->cache->readFromCache('json' . DIRECTORY_SEPARATOR . $path . $cacheDataName . '.headers',
500
+                $headers = $this->cache->readFromCache('json'.DIRECTORY_SEPARATOR.$path.$cacheDataName.'.headers',
501 501
                     $cache, null, Cache::JSON);
502 502
                 Template::getInstance()->renderCache($cachedData, $headers);
503 503
                 $execute = FALSE;
@@ -540,11 +540,11 @@  discard block
 block discarded – undo
540 540
     private function loadExternalAutoloader($hydrateRoute, SplFileInfo $modulePath, $externalModulePath)
541 541
     {
542 542
         $extModule = $modulePath->getBasename();
543
-        $moduleAutoloader = realpath($externalModulePath . DIRECTORY_SEPARATOR . $extModule . DIRECTORY_SEPARATOR . 'autoload.php');
544
-        if(file_exists($moduleAutoloader)) {
543
+        $moduleAutoloader = realpath($externalModulePath.DIRECTORY_SEPARATOR.$extModule.DIRECTORY_SEPARATOR.'autoload.php');
544
+        if (file_exists($moduleAutoloader)) {
545 545
             include_once $moduleAutoloader;
546 546
             if ($hydrateRoute) {
547
-                $this->routing = $this->inspectDir($externalModulePath . DIRECTORY_SEPARATOR . $extModule, '\\' . $extModule, $this->routing);
547
+                $this->routing = $this->inspectDir($externalModulePath.DIRECTORY_SEPARATOR.$extModule, '\\'.$extModule, $this->routing);
548 548
             }
549 549
         }
550 550
     }
@@ -558,14 +558,14 @@  discard block
 block discarded – undo
558 558
     {
559 559
         try {
560 560
             $module = preg_replace('/(\\\|\/)/', DIRECTORY_SEPARATOR, $module);
561
-            $externalModulePath = VENDOR_DIR . DIRECTORY_SEPARATOR . $module . DIRECTORY_SEPARATOR . 'src';
561
+            $externalModulePath = VENDOR_DIR.DIRECTORY_SEPARATOR.$module.DIRECTORY_SEPARATOR.'src';
562 562
             $externalModule = $this->finder->directories()->in($externalModulePath)->depth(0);
563
-            if(is_array($externalModule)) {
563
+            if (is_array($externalModule)) {
564 564
                 foreach ($externalModule as $modulePath) {
565 565
                     $this->loadExternalAutoloader($hydrateRoute, $modulePath, $externalModulePath);
566 566
                 }
567 567
             }
568
-        } catch (\Exception $e) {
568
+        }catch (\Exception $e) {
569 569
             Logger::log($e->getMessage(), LOG_WARNING);
570 570
             $module = null;
571 571
         }
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
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
  */
10 10
 class FileHelper {
11 11
     /**
12
-     * @param mixed $data
12
+     * @param string $data
13 13
      * @param string $path
14 14
      * @return int
15 15
      */
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
     }
53 53
 
54 54
     /**
55
-     * @param $path
55
+     * @param string $path
56 56
      * @throws IOException
57 57
      */
58 58
     public static function deleteDir($path) {
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
      */
24 24
     public static function readFile($path) {
25 25
         $data = false;
26
-        if(file_exists($path)) {
26
+        if (file_exists($path)) {
27 27
             $data = @file_get_contents($path);
28 28
         }
29 29
         return $data;
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
      * @return string
37 37
      */
38 38
     public static function generateHashFilename($verb, $slug, array $query = []) {
39
-        return sha1(strtolower($verb) . ' ' . $slug . ' ' . strtolower(http_build_query($query)));
39
+        return sha1(strtolower($verb).' '.$slug.' '.strtolower(http_build_query($query)));
40 40
     }
41 41
 
42 42
     /**
@@ -47,8 +47,8 @@  discard block
 block discarded – undo
47 47
     public static function generateCachePath(array $action, array $query = []) {
48 48
         $class = GeneratorHelper::extractClassFromNamespace($action['class']);
49 49
         $filename = self::generateHashFilename($action['http'], $action['slug'], $query);
50
-        $subPath = substr($filename, 0, 2) . DIRECTORY_SEPARATOR . substr($filename, 2, 2);
51
-        return $action['module'] . DIRECTORY_SEPARATOR . $class . DIRECTORY_SEPARATOR . $action['method'] . DIRECTORY_SEPARATOR . $subPath . DIRECTORY_SEPARATOR;
50
+        $subPath = substr($filename, 0, 2).DIRECTORY_SEPARATOR.substr($filename, 2, 2);
51
+        return $action['module'].DIRECTORY_SEPARATOR.$class.DIRECTORY_SEPARATOR.$action['method'].DIRECTORY_SEPARATOR.$subPath.DIRECTORY_SEPARATOR;
52 52
     }
53 53
 
54 54
     /**
Please login to merge, or discard this patch.
src/base/Singleton.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
      */
23 23
     public function __construct()
24 24
     {
25
-        Logger::log(get_class($this) . ' constructor invoked');
25
+        Logger::log(get_class($this).' constructor invoked');
26 26
         $this->init();
27 27
     }
28 28
 
@@ -80,14 +80,14 @@  discard block
 block discarded – undo
80 80
         $calledClass = static::class;
81 81
         try {
82 82
             $instance = InjectorHelper::constructInyectableInstance($variable, $singleton, $classNameSpace, $calledClass);
83
-            $setter = 'set' . ucfirst($variable);
83
+            $setter = 'set'.ucfirst($variable);
84 84
             if (method_exists($calledClass, $setter)) {
85 85
                 $this->$setter($instance);
86
-            } else {
86
+            }else {
87 87
                 $this->$variable = $instance;
88 88
             }
89
-        } catch (\Exception $e) {
90
-            Logger::log($e->getMessage() . ': ' . $e->getFile() . ' [' . $e->getLine() . ']', LOG_ERR);
89
+        }catch (\Exception $e) {
90
+            Logger::log($e->getMessage().': '.$e->getFile().' ['.$e->getLine().']', LOG_ERR);
91 91
             throw $e;
92 92
         }
93 93
         return $this;
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
     {
103 103
         if (!$this->isLoaded()) {
104 104
             $filename = sha1(get_class($this));
105
-            $cacheFilename = 'reflections' . DIRECTORY_SEPARATOR . substr($filename, 0, 2) . DIRECTORY_SEPARATOR . substr($filename, 2, 2) . DIRECTORY_SEPARATOR . $filename . ".json";
105
+            $cacheFilename = 'reflections'.DIRECTORY_SEPARATOR.substr($filename, 0, 2).DIRECTORY_SEPARATOR.substr($filename, 2, 2).DIRECTORY_SEPARATOR.$filename.".json";
106 106
             /** @var \PSFS\base\Cache $cacheService */
107 107
             $cacheService = Cache::getInstance();
108 108
             /** @var \PSFS\base\config\Config $configService */
@@ -120,8 +120,8 @@  discard block
 block discarded – undo
120 120
                 }
121 121
             }
122 122
             $this->setLoaded();
123
-        } else {
124
-            Logger::log(get_class($this) . ' already loaded', LOG_INFO);
123
+        }else {
124
+            Logger::log(get_class($this).' already loaded', LOG_INFO);
125 125
         }
126 126
     }
127 127
 }
Please login to merge, or discard this patch.