Passed
Push — master ( d59fda...dc7489 )
by Fran
03:09
created
src/base/types/traits/Api/MutationTrait.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
         if (count($pks) === 1) {
100 100
             $pks = array_keys($pks);
101 101
             return [
102
-                $tableMap::TABLE_NAME . '.' . $pks[0] => Api::API_MODEL_KEY_FIELD
102
+                $tableMap::TABLE_NAME.'.'.$pks[0] => Api::API_MODEL_KEY_FIELD
103 103
             ];
104 104
         }
105 105
         if (count($pks) > 1) {
@@ -107,9 +107,9 @@  discard block
 block discarded – undo
107 107
             $principal = '';
108 108
             $sep = 'CONCAT(';
109 109
             foreach ($pks as $pk) {
110
-                $apiPks[$tableMap::TABLE_NAME . '.' . $pk->getName()] = $pk->getPhpName();
111
-                $principal .= $sep . $tableMap::TABLE_NAME . '.' . $pk->getName();
112
-                $sep = ', "' . Api::API_PK_SEPARATOR . '", ';
110
+                $apiPks[$tableMap::TABLE_NAME.'.'.$pk->getName()] = $pk->getPhpName();
111
+                $principal .= $sep.$tableMap::TABLE_NAME.'.'.$pk->getName();
112
+                $sep = ', "'.Api::API_PK_SEPARATOR.'", ';
113 113
             }
114 114
             $principal .= ')';
115 115
             $apiPks[$principal] = Api::API_MODEL_KEY_FIELD;
@@ -136,10 +136,10 @@  discard block
 block discarded – undo
136 136
         $pks = '';
137 137
         $sep = '';
138 138
         foreach ($tableMap->getPrimaryKeys() as $pk) {
139
-            $pks .= $sep . $pk->getFullyQualifiedName();
139
+            $pks .= $sep.$pk->getFullyQualifiedName();
140 140
             $sep = ', "|", ';
141 141
         }
142
-        $this->extraColumns['CONCAT("' . $tableMap->getPhpName() . ' #", ' . $pks . ')'] = Api::API_LIST_NAME_FIELD;
142
+        $this->extraColumns['CONCAT("'.$tableMap->getPhpName().' #", '.$pks.')'] = Api::API_LIST_NAME_FIELD;
143 143
     }
144 144
 
145 145
     /**
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
             }
162 162
             if (null !== $column) {
163 163
                 $this->extraColumns[$column->getFullyQualifiedName()] = Api::API_LIST_NAME_FIELD;
164
-            } else {
164
+            }else {
165 165
                 $this->addClassListName($tableMap);
166 166
             }
167 167
         }
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
      * @param $action
173 173
      * @throws ApiException
174 174
      */
175
-    private function addExtraColumns(ModelCriteria &$query, $action)
175
+    private function addExtraColumns(ModelCriteria & $query, $action)
176 176
     {
177 177
         if (Api::API_ACTION_LIST === $action) {
178 178
             $this->addDefaultListField();
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
         if (!empty($this->extraColumns)) {
182 182
             if (Config::getParam('api.extrafields.compat', true)) {
183 183
                 $fields = array_values($this->extraColumns);
184
-            } else {
184
+            }else {
185 185
                 $returnFields = Request::getInstance()->getQuery(Api::API_FIELDS_RESULT_FIELD);
186 186
                 $fields = explode(',', $returnFields ?: '');
187 187
                 $fields[] = self::API_MODEL_KEY_FIELD;
@@ -215,22 +215,22 @@  discard block
 block discarded – undo
215 215
     /**
216 216
      * @param ModelCriteria $query
217 217
      */
218
-    protected function checkI18n(ModelCriteria &$query)
218
+    protected function checkI18n(ModelCriteria & $query)
219 219
     {
220 220
         $this->extractApiLang();
221 221
         $model = $this->getModelNamespace();
222
-        $modelI18n = $model . 'I18n';
222
+        $modelI18n = $model.'I18n';
223 223
         if (method_exists($query, 'useI18nQuery')) {
224 224
             $query->useI18nQuery($this->lang);
225 225
             $modelParts = explode('\\', $modelI18n);
226
-            $i18nMapClass = str_replace(end($modelParts), 'Map\\' . end($modelParts), $modelI18n) . 'TableMap';
226
+            $i18nMapClass = str_replace(end($modelParts), 'Map\\'.end($modelParts), $modelI18n).'TableMap';
227 227
             /** @var TableMap $modelI18nTableMap */
228 228
             $modelI18nTableMap = $i18nMapClass::getTableMap();
229 229
             foreach ($modelI18nTableMap->getColumns() as $columnMap) {
230 230
                 if (!$columnMap->isPrimaryKey()) {
231 231
                     $query->withColumn($columnMap->getFullyQualifiedName(), ApiHelper::getColumnMapName($columnMap));
232 232
                 } elseif (!$columnMap->isForeignKey()) {
233
-                    $query->withColumn('IFNULL(' . $columnMap->getFullyQualifiedName() . ', "' . $this->lang . '")', ApiHelper::getColumnMapName($columnMap));
233
+                    $query->withColumn('IFNULL('.$columnMap->getFullyQualifiedName().', "'.$this->lang.'")', ApiHelper::getColumnMapName($columnMap));
234 234
                 }
235 235
             }
236 236
         }
@@ -245,12 +245,12 @@  discard block
 block discarded – undo
245 245
         $model->fromArray($data, ApiHelper::getFieldTypes());
246 246
         $tableMap = $this->getTableMap();
247 247
         try {
248
-            if ($tableMap->hasRelation($tableMap->getPhpName() . 'I18n')) {
249
-                $relateI18n = $tableMap->getRelation($tableMap->getPhpName() . 'I18n');
248
+            if ($tableMap->hasRelation($tableMap->getPhpName().'I18n')) {
249
+                $relateI18n = $tableMap->getRelation($tableMap->getPhpName().'I18n');
250 250
                 $i18NTableMap = $relateI18n->getLocalTable();
251 251
                 $model->setLocale(array_key_exists('Locale', $data) ? $data['Locale'] : (array_key_exists('locale', $data) ? $data['locale'] : Request::header(Api::HEADER_API_LANG, 'es_ES')));
252 252
                 foreach ($i18NTableMap->getColumns() as $columnMap) {
253
-                    $method = 'set' . $columnMap->getPhpName();
253
+                    $method = 'set'.$columnMap->getPhpName();
254 254
                     $dtoColumnName = ApiHelper::getColumnMapName($columnMap);
255 255
                     if (array_key_exists($dtoColumnName, $data)
256 256
                         && method_exists($model, $method)
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
                     }
260 260
                 }
261 261
             }
262
-        } catch (Exception $e) {
262
+        }catch (Exception $e) {
263 263
             Logger::log($e->getMessage(), LOG_DEBUG);
264 264
         }
265 265
     }
Please login to merge, or discard this patch.
src/base/types/traits/Api/ConnectionTrait.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@
 block discarded – undo
52 52
             if (null !== $this->con && $this->con->inTransaction()) {
53 53
                 if ($status === 200) {
54 54
                     $this->con->commit();
55
-                } else {
55
+                }else {
56 56
                     $this->con->rollBack();
57 57
                 }
58 58
             }
Please login to merge, or discard this patch.
src/base/types/traits/BoostrapTrait.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,5 +12,5 @@
 block discarded – undo
12 12
     }
13 13
 
14 14
     define('PSFS_BOOSTRAP_TRAT_LOADED', true);
15
-    require_once __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'bootstrap.php';
15
+    require_once __DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'bootstrap.php';
16 16
 }
Please login to merge, or discard this patch.
src/base/types/helpers/FileHelper.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
      * @param string $path
17 17
      * @return int|bool
18 18
      */
19
-    public static function writeFile(string $path, mixed $data): int|bool
19
+    public static function writeFile(string $path, mixed $data): int | bool
20 20
     {
21 21
         return @file_put_contents($path, $data);
22 22
     }
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
      * @param string $path
26 26
      * @return string|bool
27 27
      */
28
-    public static function readFile(string $path): string|bool
28
+    public static function readFile(string $path): string | bool
29 29
     {
30 30
         $data = false;
31 31
         if (file_exists($path)) {
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
      */
43 43
     public static function generateHashFilename(string $verb, string $slug, array $query = []): string
44 44
     {
45
-        return sha1(strtolower($verb) . ' ' . $slug . ' ' . strtolower(http_build_query($query)));
45
+        return sha1(strtolower($verb).' '.$slug.' '.strtolower(http_build_query($query)));
46 46
     }
47 47
 
48 48
     /**
@@ -54,8 +54,8 @@  discard block
 block discarded – undo
54 54
     {
55 55
         $class = GeneratorHelper::extractClassFromNamespace($action['class']);
56 56
         $filename = self::generateHashFilename($action['http'], $action['slug'], $query);
57
-        $subPath = substr($filename, 0, 2) . DIRECTORY_SEPARATOR . substr($filename, 2, 2);
58
-        return $action['module'] . DIRECTORY_SEPARATOR . $class . DIRECTORY_SEPARATOR . $action['method'] . DIRECTORY_SEPARATOR . $subPath . DIRECTORY_SEPARATOR;
57
+        $subPath = substr($filename, 0, 2).DIRECTORY_SEPARATOR.substr($filename, 2, 2);
58
+        return $action['module'].DIRECTORY_SEPARATOR.$class.DIRECTORY_SEPARATOR.$action['method'].DIRECTORY_SEPARATOR.$subPath.DIRECTORY_SEPARATOR;
59 59
     }
60 60
 
61 61
     /**
Please login to merge, or discard this patch.
src/base/config/ConfigForm.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -84,8 +84,8 @@
 block discarded – undo
84 84
             'icon' => 'fa-plus',
85 85
         ];
86 86
         if (Config::getParam('admin.version', 'v1') === 'v1') {
87
-            $add['onclick'] = 'javascript:addNewField(document.getElementById("' . $this->getName() . '"));';
88
-        } else {
87
+            $add['onclick'] = 'javascript:addNewField(document.getElementById("'.$this->getName().'"));';
88
+        }else {
89 89
             $add['ng-click'] = 'addNewField()';
90 90
         }
91 91
         $this->addButton('submit', t('Guardar configuración'), 'submit', array(
Please login to merge, or discard this patch.
src/base/extension/AssetsParser.php 1 patch
Spacing   +14 added lines, -14 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
 /**
20 20
  * Class AssetsParser
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
     public function __construct($type = 'js')
82 82
     {
83 83
         $this->type = $type;
84
-        $this->path = WEB_DIR . DIRECTORY_SEPARATOR;
84
+        $this->path = WEB_DIR.DIRECTORY_SEPARATOR;
85 85
         $this->domains = Template::getDomains(true);
86 86
         $this->cdnPath = Config::getParam('resources.cdn.url', Request::getInstance()->getRootUrl());
87 87
     }
@@ -94,12 +94,12 @@  discard block
 block discarded – undo
94 94
      */
95 95
     public function addFile($filename)
96 96
     {
97
-        if (file_exists($this->path . $filename) && preg_match('/\.' . $this->type . '$/i', $filename)) {
97
+        if (file_exists($this->path.$filename) && preg_match('/\.'.$this->type.'$/i', $filename)) {
98 98
             $this->files[] = $filename;
99 99
         } elseif (!empty($this->domains)) {
100 100
             foreach ($this->domains as $domain => $paths) {
101 101
                 $domainFilename = str_replace($domain, $paths["public"], $filename);
102
-                if (file_exists($domainFilename) && preg_match('/\.' . $this->type . '$/i', $domainFilename)) {
102
+                if (file_exists($domainFilename) && preg_match('/\.'.$this->type.'$/i', $domainFilename)) {
103 103
                     $this->files[] = $domainFilename;
104 104
                 }
105 105
             }
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
     public function setHash($hash)
117 117
     {
118 118
         $cache = Config::getParam('cache.var', '');
119
-        $this->hash = $hash . (strlen($cache) ? '.' : '') . $cache;
119
+        $this->hash = $hash.(strlen($cache) ? '.' : '').$cache;
120 120
         return $this;
121 121
     }
122 122
 
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
             $sourceFile = explode("?", $sourceFile);
179 179
             $sourceFile = $sourceFile[0];
180 180
         }
181
-        $orig = realpath(dirname($filenamePath) . DIRECTORY_SEPARATOR . $sourceFile);
181
+        $orig = realpath(dirname($filenamePath).DIRECTORY_SEPARATOR.$sourceFile);
182 182
         return $orig;
183 183
     }
184 184
 
@@ -197,13 +197,13 @@  discard block
 block discarded – undo
197 197
                 $orig = self::calculateResourcePathname($filenamePath, $source);
198 198
                 if (!empty($orig)) {
199 199
                     $orig_part = preg_split("/Public/i", $orig);
200
-                    $dest = WEB_DIR . $orig_part[1];
200
+                    $dest = WEB_DIR.$orig_part[1];
201 201
                     GeneratorHelper::createDir(dirname($dest));
202 202
                     if (@copy($orig, $dest) === false) {
203
-                        throw new ConfigException("Can't copy " . $orig . " to " . $dest);
203
+                        throw new ConfigException("Can't copy ".$orig." to ".$dest);
204 204
                     }
205
-                } else {
206
-                    Logger::log($filenamePath . ' has an empty origin with the url ' . $source, LOG_WARNING);
205
+                }else {
206
+                    Logger::log($filenamePath.' has an empty origin with the url '.$source, LOG_WARNING);
207 207
                 }
208 208
             }
209 209
         }
@@ -219,9 +219,9 @@  discard block
 block discarded – undo
219 219
     {
220 220
         if (array_key_exists($hash, $this->sri)) {
221 221
             $sriHash = $this->sri[$hash];
222
-        } else {
223
-            Inspector::stats('[SRITrait] Generating SRI for ' . $hash, Inspector::SCOPE_DEBUG);
224
-            $filename = WEB_DIR . DIRECTORY_SEPARATOR . $type . DIRECTORY_SEPARATOR . $hash . '.' . $type;
222
+        }else {
223
+            Inspector::stats('[SRITrait] Generating SRI for '.$hash, Inspector::SCOPE_DEBUG);
224
+            $filename = WEB_DIR.DIRECTORY_SEPARATOR.$type.DIRECTORY_SEPARATOR.$hash.'.'.$type;
225 225
             $sriHash = base64_encode(hash("sha384", file_get_contents($filename), true));
226 226
             $this->sri[$hash] = $sriHash;
227 227
             Cache::getInstance()->storeData($this->sriFilename, $this->sri, Cache::JSON, true);
Please login to merge, or discard this patch.
src/base/extension/CustomTranslateExtension.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
     {
49 49
         // Gather always the base translations
50 50
         $standardTranslations = [];
51
-        self::$filename = implode(DIRECTORY_SEPARATOR, [LOCALE_DIR, 'custom', self::$locale . '.json']);
51
+        self::$filename = implode(DIRECTORY_SEPARATOR, [LOCALE_DIR, 'custom', self::$locale.'.json']);
52 52
         if (file_exists(self::$filename)) {
53 53
             $standardTranslations = json_decode(file_get_contents(self::$filename), true);
54 54
         }
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
         $session_locale = $session->getSessionKey(I18nHelper::PSFS_SESSION_LANGUAGE_KEY);
68 68
         self::$locale = $forceReload ? $session_locale : I18nHelper::extractLocale($session_locale);
69 69
         $version = $session->getSessionKey(self::LOCALE_CACHED_VERSION);
70
-        $configVersion = self::$locale . '_' . Config::getParam('cache.var', 'v1');
70
+        $configVersion = self::$locale.'_'.Config::getParam('cache.var', 'v1');
71 71
         if ($forceReload) {
72 72
             Inspector::stats('[translationsCheckLoad] Force translations reload', Inspector::SCOPE_DEBUG);
73 73
             self::dropInstance();
@@ -80,19 +80,19 @@  discard block
 block discarded – undo
80 80
             if (null !== $version && $version === $configVersion) {
81 81
                 Inspector::stats('[translationsCheckLoad] Translations loaded from session', Inspector::SCOPE_DEBUG);
82 82
                 self::$translations = $session->getSessionKey(self::LOCALE_CACHED_TAG);
83
-            } else {
83
+            }else {
84 84
                 if (!$useBase) {
85 85
                     $customKey = $customKey ?: $session->getSessionKey(self::CUSTOM_LOCALE_SESSION_KEY);
86 86
                 }
87 87
                 $standardTranslations = self::extractBaseTranslations();
88 88
                 // If the project has custom translations, gather them
89 89
                 if (null !== $customKey) {
90
-                    Logger::log('[' . self::class . '] Custom key detected: ' . $customKey, LOG_INFO);
91
-                    self::$filename = implode(DIRECTORY_SEPARATOR, [LOCALE_DIR, 'custom', $customKey, self::$locale . '.json']);
90
+                    Logger::log('['.self::class.'] Custom key detected: '.$customKey, LOG_INFO);
91
+                    self::$filename = implode(DIRECTORY_SEPARATOR, [LOCALE_DIR, 'custom', $customKey, self::$locale.'.json']);
92 92
                 }
93 93
                 // Finally we merge base and custom translations to complete all the i18n set
94 94
                 if (file_exists(self::$filename)) {
95
-                    Logger::log('[' . self::class . '] Custom locale detected: ' . $customKey . ' [' . self::$locale . ']', LOG_INFO);
95
+                    Logger::log('['.self::class.'] Custom locale detected: '.$customKey.' ['.self::$locale.']', LOG_INFO);
96 96
                     self::$translations = array_merge($standardTranslations, json_decode(file_get_contents(self::$filename), true));
97 97
                     $session->setSessionKey(self::LOCALE_CACHED_TAG, self::$translations);
98 98
                     $session->setSessionKey(self::LOCALE_CACHED_VERSION, $configVersion);
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
     public function getFilters()
119 119
     {
120 120
         return array(
121
-            new TwigFilter('trans', function ($message) {
121
+            new TwigFilter('trans', function($message) {
122 122
                 return self::_($message);
123 123
             }),
124 124
         );
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
         }
146 146
         if (is_array(self::$translations) && array_key_exists($message, self::$translations)) {
147 147
             $translation = self::$translations[$message];
148
-        } else {
148
+        }else {
149 149
             $translation = gettext($message);
150 150
         }
151 151
         if (self::$generate) {
Please login to merge, or discard this patch.
src/base/extension/traits/JsTrait.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -25,8 +25,8 @@  discard block
 block discarded – undo
25 25
             foreach ($compiledFiles as $file) {
26 26
                 echo "\t\t<script type='text/javascript' src='{$file}'></script>\n";
27 27
             }
28
-        } else {
29
-            echo "\t\t<script type='text/javascript' src='" . $baseUrl . "/js/" . $hash . ".js'" .
28
+        }else {
29
+            echo "\t\t<script type='text/javascript' src='".$baseUrl."/js/".$hash.".js'".
30 30
                 "></script>\n";
31 31
         }
32 32
     }
@@ -42,12 +42,12 @@  discard block
 block discarded – undo
42 42
      */
43 43
     protected function putDebugJs($pathParts, $base, $file, $hash, array &$compiledFiles)
44 44
     {
45
-        $filePath = $hash . "_" . $pathParts[count($pathParts) - 1];
46
-        $compiledFiles[] = "/js/" . $filePath;
45
+        $filePath = $hash."_".$pathParts[count($pathParts) - 1];
46
+        $compiledFiles[] = "/js/".$filePath;
47 47
         $data = "";
48
-        if (!file_exists($base . $filePath) || filemtime($base . $filePath) < filemtime($file)) {
48
+        if (!file_exists($base.$filePath) || filemtime($base.$filePath) < filemtime($file)) {
49 49
             $data = file_get_contents($file);
50
-            AssetsHelper::storeContents($base . $filePath, $data);
50
+            AssetsHelper::storeContents($base.$filePath, $data);
51 51
         }
52 52
         return $data;
53 53
     }
@@ -63,9 +63,9 @@  discard block
 block discarded – undo
63 63
      */
64 64
     protected function compileJs(array $files, $basePath, $hash, array &$compiledFiles)
65 65
     {
66
-        $base = $basePath . "js" . DIRECTORY_SEPARATOR;
66
+        $base = $basePath."js".DIRECTORY_SEPARATOR;
67 67
         $debug = Config::getParam('debug');
68
-        if ($debug || !file_exists($base . $hash . ".js")) {
68
+        if ($debug || !file_exists($base.$hash.".js")) {
69 69
             $data = '';
70 70
             if (0 < count($files)) {
71 71
                 $minifier = new JS();
@@ -74,15 +74,15 @@  discard block
 block discarded – undo
74 74
                     if (file_exists($file)) {
75 75
                         if ($debug) {
76 76
                             $data = $this->putDebugJs($pathParts, $base, $file, $hash, $compiledFiles);
77
-                        } elseif (!file_exists($base . $hash . ".js")) {
77
+                        } elseif (!file_exists($base.$hash.".js")) {
78 78
                             $minifier->add($file);
79 79
                             //$data = $this->putProductionJs($base, $file, $data);
80 80
                         }
81 81
                     }
82 82
                 }
83 83
                 if ($debug) {
84
-                    AssetsHelper::storeContents($base . $hash . ".js", $data);
85
-                } else {
84
+                    AssetsHelper::storeContents($base.$hash.".js", $data);
85
+                }else {
86 86
                     $this->dumpJs($hash, $base, $minifier);
87 87
                 }
88 88
                 unset($minifier);
@@ -103,9 +103,9 @@  discard block
 block discarded – undo
103 103
         ini_set('memory_limit', -1);
104 104
         GeneratorHelper::createDir($base);
105 105
         if (Config::getParam('assets.obfuscate', false)) {
106
-            $minifier->gzip($base . $hash . ".js");
107
-        } else {
108
-            $minifier->minify($base . $hash . ".js");
106
+            $minifier->gzip($base.$hash.".js");
107
+        }else {
108
+            $minifier->minify($base.$hash.".js");
109 109
         }
110 110
     }
111 111
 }
Please login to merge, or discard this patch.
src/base/extension/traits/CssTrait.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -32,8 +32,8 @@  discard block
 block discarded – undo
32 32
     protected function compileCss($basePath, $hash)
33 33
     {
34 34
         $debug = Config::getParam('debug');
35
-        $base = $basePath . "css" . DIRECTORY_SEPARATOR;
36
-        if ($debug || !file_exists($base . $hash . ".css")) {
35
+        $base = $basePath."css".DIRECTORY_SEPARATOR;
36
+        if ($debug || !file_exists($base.$hash.".css")) {
37 37
             $data = '';
38 38
             if (0 < count($this->files)) {
39 39
                 $minifier = new CSS();
@@ -42,14 +42,14 @@  discard block
 block discarded – undo
42 42
                 }
43 43
             }
44 44
             if ($debug) {
45
-                AssetsHelper::storeContents($base . $hash . ".css", $data);
46
-            } else {
45
+                AssetsHelper::storeContents($base.$hash.".css", $data);
46
+            }else {
47 47
                 $minifier = new CSS();
48 48
                 $minifier->add($data);
49 49
                 ini_set('max_execution_time', -1);
50 50
                 ini_set('memory_limit', -1);
51 51
                 GeneratorHelper::createDir($base);
52
-                $minifier->minify($base . $hash . ".css");
52
+                $minifier->minify($base.$hash.".css");
53 53
             }
54 54
             unset($minifier);
55 55
         }
@@ -69,21 +69,21 @@  discard block
 block discarded – undo
69 69
         if (file_exists($file)) {
70 70
             $debug = Config::getParam('debug');
71 71
             $pathParts = explode("/", $file);
72
-            $filePath = $this->hash . "_" . $pathParts[count($pathParts) - 1];
73
-            if (!file_exists($base . $filePath) || filemtime($base . $filePath) < filemtime($file) || $debug) {
72
+            $filePath = $this->hash."_".$pathParts[count($pathParts) - 1];
73
+            if (!file_exists($base.$filePath) || filemtime($base.$filePath) < filemtime($file) || $debug) {
74 74
                 //Si tenemos modificaciones tenemos que compilar de nuevo todos los ficheros modificados
75
-                if (file_exists($base . $hash . ".css") && @unlink($base . $hash . ".css") === false) {
76
-                    throw new ConfigException("Can't unlink file " . $base . $hash . ".css");
75
+                if (file_exists($base.$hash.".css") && @unlink($base.$hash.".css") === false) {
76
+                    throw new ConfigException("Can't unlink file ".$base.$hash.".css");
77 77
                 }
78 78
                 $this->loopCssLines($file);
79 79
             }
80 80
             if ($debug) {
81 81
                 $data = file_get_contents($file);
82
-                AssetsHelper::storeContents($base . $filePath, $data);
83
-            } else {
82
+                AssetsHelper::storeContents($base.$filePath, $data);
83
+            }else {
84 84
                 $data .= file_get_contents($file);
85 85
             }
86
-            $this->compiledFiles[] = "/css/" . $filePath;
86
+            $this->compiledFiles[] = "/css/".$filePath;
87 87
         }
88 88
 
89 89
         return $data;
@@ -115,25 +115,25 @@  discard block
 block discarded – undo
115 115
      */
116 116
     protected function extractCssResources($source, $file)
117 117
     {
118
-        Inspector::stats('[CssTrait] Start collecting resources from ' . $file, Inspector::SCOPE_DEBUG);
118
+        Inspector::stats('[CssTrait] Start collecting resources from '.$file, Inspector::SCOPE_DEBUG);
119 119
         $sourceFile = AssetsHelper::extractSourceFilename($source);
120
-        $orig = realpath(dirname($file) . DIRECTORY_SEPARATOR . $sourceFile);
120
+        $orig = realpath(dirname($file).DIRECTORY_SEPARATOR.$sourceFile);
121 121
         $origPart = preg_split('/(\/|\\\)public(\/|\\\)/i', $orig);
122 122
         try {
123 123
             if (count($source) > 1 && array_key_exists(1, $origPart)) {
124
-                $dest = $this->path . $origPart[1];
124
+                $dest = $this->path.$origPart[1];
125 125
                 GeneratorHelper::createDir(dirname($dest));
126 126
                 if (!file_exists($dest) || filemtime($orig) > filemtime($dest)) {
127 127
                     if (@copy($orig, $dest) === FALSE) {
128
-                        throw new \RuntimeException('Can\' copy ' . $dest . '');
128
+                        throw new \RuntimeException('Can\' copy '.$dest.'');
129 129
                     }
130 130
                     Logger::log("$orig copiado a $dest", LOG_INFO);
131 131
                 }
132 132
             }
133
-        } catch (\Exception $e) {
133
+        }catch (\Exception $e) {
134 134
             Logger::log($e->getMessage(), LOG_ERR);
135 135
         }
136
-        Inspector::stats('[CssTrait] End collecting resources from ' . $file, Inspector::SCOPE_DEBUG);
136
+        Inspector::stats('[CssTrait] End collecting resources from '.$file, Inspector::SCOPE_DEBUG);
137 137
     }
138 138
 
139 139
     /**
@@ -147,8 +147,8 @@  discard block
 block discarded – undo
147 147
             foreach ($compiledFiles as $file) {
148 148
                 echo "\t\t<link href='{$file}' rel='stylesheet' media='screen, print'>";
149 149
             }
150
-        } else {
151
-            echo "\t\t<link href='" . $baseUrl . "/css/" . $hash . ".css' rel='stylesheet' " .
150
+        }else {
151
+            echo "\t\t<link href='".$baseUrl."/css/".$hash.".css' rel='stylesheet' ".
152 152
                 //"crossorigin='anonymous' integrity='sha384-" . $sri . "'>";
153 153
                 "media='screen, print'>";
154 154
         }
Please login to merge, or discard this patch.