Total Complexity | 8 |
Total Lines | 86 |
Duplicated Lines | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
5 | class ParsedTemplate |
||
6 | { |
||
7 | /** @var string */ |
||
8 | protected $type; |
||
9 | |||
10 | /** @var string */ |
||
11 | protected $identifier; |
||
12 | |||
13 | /** @var string[] */ |
||
14 | protected $attributes; |
||
15 | |||
16 | /** @var string[] */ |
||
17 | protected $occurences; |
||
18 | |||
19 | /** |
||
20 | * ParsedData constructor. |
||
21 | * |
||
22 | * @param string $type |
||
23 | * @param string $identifier |
||
24 | * @param string[] $attributes |
||
25 | * @param string[] $occurences |
||
26 | */ |
||
27 | public function __construct(string $type, string $identifier, array $attributes = [], array $occurences = []) |
||
28 | { |
||
29 | $this->type = $type; |
||
30 | $this->identifier = $identifier; |
||
31 | $this->attributes = $attributes; |
||
32 | $this->occurences = $occurences; |
||
33 | } |
||
34 | |||
35 | /** |
||
36 | * @return string |
||
37 | */ |
||
38 | public function getType(): string |
||
39 | { |
||
40 | return $this->type; |
||
41 | } |
||
42 | |||
43 | /** |
||
44 | * @return string |
||
45 | */ |
||
46 | public function getIdentifier(): string |
||
49 | } |
||
50 | |||
51 | /** |
||
52 | * @return string[] |
||
53 | */ |
||
54 | public function getAttributes(): array |
||
57 | } |
||
58 | |||
59 | /** |
||
60 | * @param string $attribute |
||
61 | * |
||
62 | * @return string|null |
||
63 | */ |
||
64 | public function getAttribute(string $attribute): ?string |
||
65 | { |
||
66 | if (array_key_exists($attribute, $this->attributes)) { |
||
67 | return $this->attributes[$attribute]; |
||
68 | } |
||
69 | |||
70 | return null; |
||
71 | } |
||
72 | |||
73 | /** |
||
74 | * @param string $occurence |
||
75 | * |
||
76 | * @return ParsedTemplate |
||
77 | */ |
||
78 | public function addOccurence(string $occurence): ParsedTemplate |
||
83 | } |
||
84 | |||
85 | /** |
||
86 | * @return string[] |
||
87 | */ |
||
88 | public function getOccurences(): array |
||
91 | } |
||
92 | } |
||
93 |