|
@@ -73,8 +73,7 @@ discard block |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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); |
|
@@ -174,8 +173,8 @@ discard block |
|
|
block discarded – undo |
|
174
|
173
|
private static function getAssetVersion($assetsVersions, $absolutePath, array $config) |
|
175
|
174
|
{ |
|
176
|
175
|
// Versions can be array or path to JSON file |
|
177
|
|
- if ( ! is_array($assetsVersions)) { |
|
178
|
|
- if ( ! file_exists($assetsVersions)) { |
|
|
176
|
+ if (!is_array($assetsVersions)) { |
|
|
177
|
+ if (!file_exists($assetsVersions)) { |
|
179
|
178
|
throw new FileNotFoundException(sprintf("Asset versions file not found: '%s'.", $assetsVersions)); |
|
180
|
179
|
} |
|
181
|
180
|
$assetsVersions = Json::decode(file_get_contents($assetsVersions), Json::FORCE_ARRAY); |