@@ -13,9 +13,9 @@ |
||
| 13 | 13 | * @param Closure(string):string|Minifier|null $minifier |
| 14 | 14 | * @return Minifier|null |
| 15 | 15 | */ |
| 16 | - public static function get(Closure|Minifier|null $minifier): ?Minifier |
|
| 16 | + public static function get(Closure | Minifier | null $minifier): ?Minifier |
|
| 17 | 17 | { |
| 18 | - if ($minifier instanceof Minifier || $minifier === null){ |
|
| 18 | + if ($minifier instanceof Minifier || $minifier === null) { |
|
| 19 | 19 | return $minifier; |
| 20 | 20 | } |
| 21 | 21 | |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | */ |
| 40 | 40 | private function isCacheValid(): bool |
| 41 | 41 | { |
| 42 | - if (file_exists($this->filePath)){ |
|
| 42 | + if (file_exists($this->filePath)) { |
|
| 43 | 43 | return (filemtime($this->filePath) + $this->cacheTime) > time(); |
| 44 | 44 | } |
| 45 | 45 | return false; |
@@ -67,11 +67,11 @@ discard block |
||
| 67 | 67 | |
| 68 | 68 | |
| 69 | 69 | $logger = $environment->getLogger(); |
| 70 | - $notCollectAssets = array_filter($assetsCollection, function ($asset) { |
|
| 70 | + $notCollectAssets = array_filter($assetsCollection, function($asset) { |
|
| 71 | 71 | return $asset->getOptions()->isNotCollect(); |
| 72 | 72 | }); |
| 73 | 73 | |
| 74 | - $collectAssets = array_filter($assetsCollection, function ($asset) { |
|
| 74 | + $collectAssets = array_filter($assetsCollection, function($asset) { |
|
| 75 | 75 | return !$asset->getOptions()->isNotCollect(); |
| 76 | 76 | }); |
| 77 | 77 | |
@@ -95,7 +95,7 @@ |
||
| 95 | 95 | ); |
| 96 | 96 | } |
| 97 | 97 | |
| 98 | - return array_filter($assetsCollection, function (Asset $asset) { |
|
| 98 | + return array_filter($assetsCollection, function(Asset $asset) { |
|
| 99 | 99 | return $asset->isValid(); |
| 100 | 100 | }); |
| 101 | 101 | } |
@@ -46,7 +46,7 @@ |
||
| 46 | 46 | } |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | - private function getNormalizedPath(string $path): false|string |
|
| 49 | + private function getNormalizedPath(string $path): false | string |
|
| 50 | 50 | { |
| 51 | 51 | if ($this->isUrl()) { |
| 52 | 52 | return $this->url; |
@@ -36,7 +36,7 @@ |
||
| 36 | 36 | */ |
| 37 | 37 | public function add( |
| 38 | 38 | AssetType $type, |
| 39 | - array|string $paths, |
|
| 39 | + array | string $paths, |
|
| 40 | 40 | string $group = self::GROUP_COMMON, |
| 41 | 41 | string $method = 'push' |
| 42 | 42 | ): Assets { |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | { |
| 20 | 20 | |
| 21 | 21 | |
| 22 | - private false|string $content; |
|
| 22 | + private false | string $content; |
|
| 23 | 23 | |
| 24 | 24 | |
| 25 | 25 | private LoggerInterface $logger; |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | |
| 53 | - private function getContent(): false|string |
|
| 53 | + private function getContent(): false | string |
|
| 54 | 54 | { |
| 55 | 55 | if (!$this->asset->isValid()) { |
| 56 | 56 | return false; |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | |
| 66 | - private function readUrl(string $url): false|string |
|
| 66 | + private function readUrl(string $url): false | string |
|
| 67 | 67 | { |
| 68 | 68 | if ( |
| 69 | 69 | null !== ($httpClient = $this->environment->getHttpClient()) |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | /** |
| 84 | 84 | * @throws RuntimeException |
| 85 | 85 | */ |
| 86 | - private function readWithPhpFileGetContents(string $url): false|string |
|
| 86 | + private function readWithPhpFileGetContents(string $url): false | string |
|
| 87 | 87 | { |
| 88 | 88 | //Clear the most recent error |
| 89 | 89 | error_clear_last(); |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | string $url, |
| 102 | 102 | ClientInterface $client, |
| 103 | 103 | RequestFactoryInterface $requestFactory |
| 104 | - ): false|string { |
|
| 104 | + ): false | string { |
|
| 105 | 105 | try { |
| 106 | 106 | $response = $client->sendRequest( |
| 107 | 107 | $requestFactory->createRequest('get', $url) |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | } |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | - private function readFile(string $filename): false|string |
|
| 124 | + private function readFile(string $filename): false | string |
|
| 125 | 125 | { |
| 126 | 126 | if (!file_exists($filename)) { |
| 127 | 127 | $this->logger->notice(sprintf("Файла по указанному пути нет: %s", $filename)); |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | { |
| 35 | 35 | $result = preg_replace_callback( |
| 36 | 36 | '/(url\([\'"]?)(?!["\'a-z]+:|[\'"]?\/{2})(.+?[^\'"])([\'"]?\))/i', |
| 37 | - function (array $m) { |
|
| 37 | + function(array $m) { |
|
| 38 | 38 | $normalizedPath = $this->getNormalizedPath($m[2]); |
| 39 | 39 | if ($normalizedPath === false) { |
| 40 | 40 | return $m[1] . $m[2] . $m[3]; |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | /** |
| 53 | 53 | * @throws Exception |
| 54 | 54 | */ |
| 55 | - private function getNormalizedPath(string $relativePath): false|string |
|
| 55 | + private function getNormalizedPath(string $relativePath): false | string |
|
| 56 | 56 | { |
| 57 | 57 | if ($this->asset->isUrl()) { |
| 58 | 58 | return $this->replaceUrls($this->asset->getPath(), $relativePath); |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | |
| 64 | - private function replaceUrls(string $baseUrl, string $relativeUrl): false|string |
|
| 64 | + private function replaceUrls(string $baseUrl, string $relativeUrl): false | string |
|
| 65 | 65 | { |
| 66 | 66 | $urlConverter = new UrlConverter(); |
| 67 | 67 | return $urlConverter->relativeToAbsolute($baseUrl, $relativeUrl); |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | * @throws Exception |
| 72 | 72 | * @psalm-suppress PossiblyFalseOperand |
| 73 | 73 | */ |
| 74 | - private function replacePath(string $filePath, string $relativePath): false|string |
|
| 74 | + private function replacePath(string $filePath, string $relativePath): false | string |
|
| 75 | 75 | { |
| 76 | 76 | $realpath = realpath( |
| 77 | 77 | pathinfo($filePath, PATHINFO_DIRNAME) . DIRECTORY_SEPARATOR |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | * @throws LoaderError |
| 55 | 55 | */ |
| 56 | 56 | public function asset( |
| 57 | - string|AssetType $type, |
|
| 57 | + string | AssetType $type, |
|
| 58 | 58 | array $paths = [], |
| 59 | 59 | string $group = Assets::GROUP_COMMON, |
| 60 | 60 | string $method = 'push' |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | |
| 68 | 68 | $this->assetsCollector->add( |
| 69 | 69 | $type, |
| 70 | - array_map(function ($item) { |
|
| 70 | + array_map(function($item) { |
|
| 71 | 71 | if ($this->loader === null) { |
| 72 | 72 | return $item; |
| 73 | 73 | } |
@@ -33,7 +33,7 @@ |
||
| 33 | 33 | } |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | - public function setOption(string $key, bool|array $value): AssetOption |
|
| 36 | + public function setOption(string $key, bool | array $value): AssetOption |
|
| 37 | 37 | { |
| 38 | 38 | $this->$key = $value; |
| 39 | 39 | return $this; |