| Total Complexity | 8 |
| Total Lines | 58 |
| Duplicated Lines | 0 % |
| Coverage | 92.86% |
| Changes | 0 | ||
| 1 | <?php |
||
| 5 | final class AssetOption |
||
| 6 | { |
||
| 7 | |||
| 8 | public const MINIFY = 'minify'; |
||
| 9 | public const REPLACE_RELATIVE_URLS = 'replaceRelativeUrls'; |
||
| 10 | public const SYMLINKS = 'symlinks'; |
||
| 11 | public const NOT_COLLECT = 'notCollect'; |
||
| 12 | public const ATTRIBUTES = 'attributes'; |
||
| 13 | |||
| 14 | private bool $minify = true; |
||
| 15 | private bool $replaceRelativeUrls = true; |
||
| 16 | private bool $notCollect = false; |
||
| 17 | /** |
||
| 18 | * @var array<string, string> |
||
| 19 | */ |
||
| 20 | private array $symlinks = []; |
||
| 21 | |||
| 22 | |||
| 23 | /** |
||
| 24 | * @param array<string, bool|array> $options |
||
| 25 | */ |
||
| 26 | 54 | public function __construct(array $options = []) |
|
| 27 | { |
||
| 28 | 54 | foreach ($options as $key => $value) { |
|
| 29 | if (!property_exists($this, $key)) { |
||
| 30 | continue; |
||
| 31 | } |
||
| 32 | $this->setOption($key, $value); |
||
| 33 | } |
||
| 34 | } |
||
| 35 | 54 | ||
| 36 | public function setOption(string $key, bool|array $value): AssetOption |
||
| 37 | 54 | { |
|
| 38 | 13 | $this->$key = $value; |
|
| 39 | return $this; |
||
| 40 | } |
||
| 41 | 13 | ||
| 42 | public function isMinify(): bool |
||
| 43 | 54 | { |
|
| 44 | return $this->minify; |
||
| 45 | } |
||
| 46 | |||
| 47 | public function isReplaceRelativeUrls(): bool |
||
| 50 | } |
||
| 51 | 24 | ||
| 52 | public function isNotCollect(): bool |
||
| 53 | 24 | { |
|
| 54 | 24 | return $this->notCollect; |
|
| 55 | } |
||
| 56 | |||
| 57 | 12 | /** |
|
| 58 | * @return array<string, string> |
||
| 59 | 12 | */ |
|
| 60 | public function getSymlinks(): array |
||
| 63 | } |
||
| 64 | } |
||
| 65 |