AssetOption   A
last analyzed

Complexity

Total Complexity 8

Size/Duplication

Total Lines 58
Duplicated Lines 0 %

Test Coverage

Coverage 92.86%

Importance

Changes 0
Metric Value
eloc 20
c 0
b 0
f 0
dl 0
loc 58
ccs 13
cts 14
cp 0.9286
rs 10
wmc 8

6 Methods

Rating   Name   Duplication   Size   Complexity  
A isReplaceRelativeUrls() 0 3 1
A setOption() 0 4 1
A __construct() 0 7 3
A getSymlinks() 0 3 1
A isNotCollect() 0 3 1
A isMinify() 0 3 1
1
<?php
2
3
namespace Enjoys\AssetsCollector;
4
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
48
    {
49
        return $this->replaceRelativeUrls;
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
61
    {
62 12
        return $this->symlinks;
63
    }
64
}
65