Conditions | 5 |
Paths | 16 |
Total Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Tests | 9 |
CRAP Score | 5 |
Changes | 0 |
1 | <?php |
||
33 | 1 | public function __construct(Config $config, string $assetPath, ?string $revision) |
|
34 | { |
||
35 | 1 | $this->config = $config; |
|
36 | 1 | $this->assetPath = $assetPath; |
|
37 | 1 | $this->rawValue = $revision ?: 'unknown'; |
|
38 | |||
39 | // Is revision only version (query parameter) or full path to asset? |
||
40 | 1 | $this->isVersion = $revision === null || !Strings::match((string) $revision, '/[.\/]/'); |
|
41 | |||
42 | 1 | $this->relativePath = ($this->isVersion ? $this->assetPath : Utils::normalizePath($revision)); |
|
43 | 1 | $this->absolutePath = $this->config->getAssetsPath() . DIRECTORY_SEPARATOR . $this->relativePath; |
|
44 | 1 | $this->relativeUrl = $this->isVersion ? ($this->assetPath . '?v=' . $this->rawValue) : $revision; |
|
45 | 1 | } |
|
46 | |||
83 |