Total Complexity | 11 |
Total Lines | 62 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
10 | class Slot |
||
11 | { |
||
12 | protected string $divId; |
||
13 | |||
14 | protected array $targets = []; |
||
15 | |||
16 | 5 | public function __construct( |
|
17 | protected string $adUnitPath, |
||
18 | protected Size|string $size, |
||
19 | ?string $divId = null |
||
20 | ) { |
||
21 | 5 | if (is_null($divId)) { |
|
22 | 3 | $divId = 'id_'.Str::random(8).'_'.time(); |
|
23 | } |
||
24 | 5 | $this->divId = $divId; |
|
25 | } |
||
26 | |||
27 | 5 | public static function make(...$arguments): static |
|
28 | { |
||
29 | 5 | return new static(...$arguments); |
|
30 | } |
||
31 | |||
32 | 4 | public function targets(): array |
|
33 | { |
||
34 | 4 | return $this->targets; |
|
35 | } |
||
36 | |||
37 | 1 | public function addTarget(string $key, string|array $value): static |
|
38 | { |
||
39 | 1 | $this->targets[$key] = $value; |
|
40 | |||
41 | 1 | return $this; |
|
42 | } |
||
43 | |||
44 | 1 | public function clearTargets(string|array|null $key = null): static |
|
57 | } |
||
58 | |||
59 | 4 | public function adUnitPath(): string |
|
62 | } |
||
63 | |||
64 | 4 | public function divId(): string |
|
65 | { |
||
66 | 4 | return $this->divId; |
|
67 | } |
||
68 | |||
69 | 4 | public function size(): Size|string |
|
72 | } |
||
73 | } |
||
74 |