Total Complexity | 11 |
Total Lines | 80 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
7 | class CAAData extends DataAbstract |
||
8 | { |
||
9 | /** |
||
10 | * @var int |
||
11 | */ |
||
12 | private $flags; |
||
13 | |||
14 | /** |
||
15 | * @var string |
||
16 | */ |
||
17 | private $tag; |
||
18 | |||
19 | /** |
||
20 | * @var string|null |
||
21 | */ |
||
22 | private $value; |
||
23 | |||
24 | public function __construct(int $flags, string $tag, string $value = null) |
||
31 | } |
||
32 | |||
33 | public function __toString(): string |
||
34 | { |
||
35 | return "{$this->flags} {$this->tag} \"{$this->value}\""; |
||
36 | } |
||
37 | |||
38 | public function getFlags(): int |
||
39 | { |
||
40 | return $this->flags; |
||
41 | } |
||
42 | |||
43 | public function getTag(): string |
||
44 | { |
||
45 | return $this->tag; |
||
46 | } |
||
47 | |||
48 | public function getValue(): ?string |
||
51 | } |
||
52 | |||
53 | public function toArray(): array |
||
54 | { |
||
55 | return [ |
||
56 | 'flags' => $this->flags, |
||
57 | 'tag' => $this->tag, |
||
58 | 'value' => $this->value, |
||
59 | ]; |
||
60 | } |
||
61 | |||
62 | public function serialize(): string |
||
63 | { |
||
64 | return \serialize($this->toArray()); |
||
65 | } |
||
66 | |||
67 | /** |
||
68 | * @param string $serialized |
||
69 | */ |
||
70 | public function unserialize($serialized): void |
||
76 | } |
||
77 | |||
78 | private function normalizeValue(string $value): string |
||
79 | { |
||
80 | $normalized = trim(str_ireplace('"', '', $value)); |
||
89 |