@@ -46,13 +46,13 @@ discard block |
||
| 46 | 46 | |
| 47 | 47 | $filePath = $returnPath = ''; |
| 48 | 48 | if (!file_exists($filePath)) { |
| 49 | - $filePath = BASE_DIR . $string; |
|
| 49 | + $filePath = BASE_DIR.$string; |
|
| 50 | 50 | } |
| 51 | 51 | $filenamePath = AssetsHelper::findDomainPath($string, $filePath); |
| 52 | - if(!empty($filenamePath)){ |
|
| 52 | + if (!empty($filenamePath)) { |
|
| 53 | 53 | $filePath = self::processAsset($string, $name, $return, $filenamePath); |
| 54 | 54 | $basePath = Config::getParam('resources.cdn.url', Request::getInstance()->getRootUrl(false)); |
| 55 | - $returnPath = empty($name) ? $basePath . '/' . $filePath : $name; |
|
| 55 | + $returnPath = empty($name) ? $basePath.'/'.$filePath : $name; |
|
| 56 | 56 | } |
| 57 | 57 | return $return ? $returnPath : ''; |
| 58 | 58 | } |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | $router = Router::getInstance(); |
| 71 | 71 | try { |
| 72 | 72 | return $router->getRoute($path, $absolute, $params); |
| 73 | - } catch (\Exception $e) { |
|
| 73 | + }catch (\Exception $e) { |
|
| 74 | 74 | Logger::log($e->getMessage()); |
| 75 | 75 | return $router->getRoute('', $absolute, $params); |
| 76 | 76 | } |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | $filenamePath = self::extractPathname($path, $domains); |
| 167 | 167 | // Check if resources has been copied to public folders |
| 168 | 168 | if (!$debug) { |
| 169 | - $cacheFilename = Config::getParam('cache.var', '__initial__') . '.file.cache'; |
|
| 169 | + $cacheFilename = Config::getParam('cache.var', '__initial__').'.file.cache'; |
|
| 170 | 170 | $cachedFiles = Cache::getInstance()->readFromCache($cacheFilename, |
| 171 | 171 | 1, fn() => [], Cache::JSON, true) ?: []; |
| 172 | 172 | // Force the resource copy |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | * |
| 188 | 188 | * @return string|array |
| 189 | 189 | */ |
| 190 | - private static function extractPathname(string $path, $domains): string|array |
|
| 190 | + private static function extractPathname(string $path, $domains): string | array |
|
| 191 | 191 | { |
| 192 | 192 | $filenamePath = $path; |
| 193 | 193 | if (!empty($domains) && !file_exists($path)) { |
@@ -226,13 +226,13 @@ discard block |
||
| 226 | 226 | * @param string $base |
| 227 | 227 | * @param string $filePath |
| 228 | 228 | */ |
| 229 | - private static function putResourceContent(string|null $name, string $filenamePath, string $base, string $filePath): void |
|
| 229 | + private static function putResourceContent(string | null $name, string $filenamePath, string $base, string $filePath): void |
|
| 230 | 230 | { |
| 231 | 231 | $data = file_get_contents($filenamePath); |
| 232 | 232 | if (!empty($name)) { |
| 233 | - file_put_contents(WEB_DIR . DIRECTORY_SEPARATOR . $name, $data); |
|
| 234 | - } else { |
|
| 235 | - file_put_contents($base . $filePath, $data); |
|
| 233 | + file_put_contents(WEB_DIR.DIRECTORY_SEPARATOR.$name, $data); |
|
| 234 | + }else { |
|
| 235 | + file_put_contents($base.$filePath, $data); |
|
| 236 | 236 | } |
| 237 | 237 | } |
| 238 | 238 | |
@@ -245,15 +245,15 @@ discard block |
||
| 245 | 245 | * @return string |
| 246 | 246 | * @throws GeneratorException |
| 247 | 247 | */ |
| 248 | - private static function processAsset(string $string, string|null $name = null, bool $return = true, string $filenamePath = ''): string |
|
| 248 | + private static function processAsset(string $string, string | null $name = null, bool $return = true, string $filenamePath = ''): string |
|
| 249 | 249 | { |
| 250 | 250 | $filePath = $filenamePath; |
| 251 | 251 | if (file_exists($filenamePath)) { |
| 252 | 252 | list($base, $htmlBase, $filePath) = AssetsHelper::calculateAssetPath($string, $name, $return, $filenamePath); |
| 253 | 253 | //Creamos el directorio si no existe |
| 254 | - GeneratorHelper::createDir($base . $htmlBase); |
|
| 254 | + GeneratorHelper::createDir($base.$htmlBase); |
|
| 255 | 255 | //Si se ha modificado |
| 256 | - if (!file_exists($base . $filePath) || filemtime($base . $filePath) < filemtime($filenamePath)) { |
|
| 256 | + if (!file_exists($base.$filePath) || filemtime($base.$filePath) < filemtime($filenamePath)) { |
|
| 257 | 257 | if ($htmlBase === 'css') { |
| 258 | 258 | self::processCssLines($filenamePath); |
| 259 | 259 | } |