@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | 'rev-manifest.json', |
| 24 | 24 | ], |
| 25 | 25 | 'missingAsset' => 'exception', // exception, notice, or ignore |
| 26 | - 'missingVersion' => 'ignore', // exception, notice, or ignore |
|
| 26 | + 'missingVersion' => 'ignore', // exception, notice, or ignore |
|
| 27 | 27 | ]; |
| 28 | 28 | |
| 29 | 29 | |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | */ |
| 52 | 52 | private function validateChoices($key, array $choices) |
| 53 | 53 | { |
| 54 | - if ( ! in_array($this->config[$key], $choices)) { |
|
| 54 | + if (!in_array($this->config[$key], $choices)) { |
|
| 55 | 55 | throw new UnexpectedValueException(sprintf( |
| 56 | 56 | "Unexpected value '%s' of '%s' configuration key. Allowed values: %s.", |
| 57 | 57 | $this->config[$key], |
@@ -82,7 +82,7 @@ |
||
| 82 | 82 | |
| 83 | 83 | |
| 84 | 84 | /** |
| 85 | - * Generate output according given format |
|
| 85 | + * Generate output according given format |
|
| 86 | 86 | * @param string $format |
| 87 | 87 | * @param string $basePath |
| 88 | 88 | * @param string $relativePath |
@@ -73,8 +73,7 @@ discard block |
||
| 73 | 73 | |
| 74 | 74 | // Get asset version |
| 75 | 75 | $versions = $config['versions'] === self::VERSIONS_AUTODETECT ? |
| 76 | - self::autodetectVersions($absolutePath, $wwwDir, $config['autodetectPaths']) : |
|
| 77 | - $config['versions']; |
|
| 76 | + self::autodetectVersions($absolutePath, $wwwDir, $config['autodetectPaths']) : $config['versions']; |
|
| 78 | 77 | $version = self::getAssetVersion($versions, $absolutePath, $config); |
| 79 | 78 | |
| 80 | 79 | return self::formatOutput($format, $basePath, $relativePath, $version); |
@@ -93,7 +92,7 @@ discard block |
||
| 93 | 92 | { |
| 94 | 93 | return Strings::replace($format, |
| 95 | 94 | '/%([^%]+)%/', |
| 96 | - function ($matches) use ($basePath, $format, $relativePath, $version) { |
|
| 95 | + function($matches) use ($basePath, $format, $relativePath, $version) { |
|
| 97 | 96 | switch ($matches[1]) { |
| 98 | 97 | case 'url': |
| 99 | 98 | return sprintf("%s/%s?v=%s", $basePath, $relativePath, $version); |
@@ -150,19 +149,19 @@ discard block |
||
| 150 | 149 | } |
| 151 | 150 | |
| 152 | 151 | // Validate arguments |
| 153 | - if ( ! is_string($relativePath)) { |
|
| 152 | + if (!is_string($relativePath)) { |
|
| 154 | 153 | throw new InvalidArgumentException(sprintf( |
| 155 | 154 | "Asset macro: Invalid type of the path argument. Required string. Given %s.", |
| 156 | 155 | gettype($relativePath) |
| 157 | 156 | )); |
| 158 | 157 | } |
| 159 | - if ( ! is_string($format)) { |
|
| 158 | + if (!is_string($format)) { |
|
| 160 | 159 | throw new InvalidArgumentException(sprintf( |
| 161 | 160 | "Asset macro: Invalid type of the format argument. Required string. Given %s.", |
| 162 | 161 | gettype($format) |
| 163 | 162 | )); |
| 164 | 163 | } |
| 165 | - if ( ! is_bool($needed)) { |
|
| 164 | + if (!is_bool($needed)) { |
|
| 166 | 165 | throw new InvalidArgumentException(sprintf( |
| 167 | 166 | "Asset macro: Invalid type of the needed argument. Required boolean. Given %s.", |
| 168 | 167 | gettype($needed) |
@@ -211,8 +210,8 @@ discard block |
||
| 211 | 210 | private static function getAssetVersion($assetsVersions, $absolutePath, array $config) |
| 212 | 211 | { |
| 213 | 212 | // Versions can be array or path to JSON file |
| 214 | - if ( ! is_array($assetsVersions)) { |
|
| 215 | - if ( ! file_exists($assetsVersions)) { |
|
| 213 | + if (!is_array($assetsVersions)) { |
|
| 214 | + if (!file_exists($assetsVersions)) { |
|
| 216 | 215 | throw new FileNotFoundException(sprintf("Asset versions file not found: '%s'.", $assetsVersions)); |
| 217 | 216 | } |
| 218 | 217 | $assetsVersions = Json::decode(file_get_contents($assetsVersions), Json::FORCE_ARRAY); |