Total Complexity | 6 |
Total Lines | 44 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
7 | final class FieldMessage implements MessageInterface |
||
8 | { |
||
9 | /** |
||
10 | * @var string[] |
||
11 | */ |
||
12 | private $messages = []; |
||
13 | |||
14 | /** |
||
15 | * @param string $code |
||
16 | * @param string $name |
||
17 | * @return FieldMessage |
||
18 | */ |
||
19 | public function attachMessage(string $code, string $name): self |
||
20 | { |
||
21 | $this->messages[$code] = $name; |
||
22 | return $this; |
||
23 | } |
||
24 | |||
25 | /** |
||
26 | * @inheritdoc |
||
27 | */ |
||
28 | public function toArray(): array |
||
29 | { |
||
30 | return $this->messages; |
||
31 | } |
||
32 | |||
33 | /** |
||
34 | * @return int |
||
35 | */ |
||
36 | public function count(): int |
||
37 | { |
||
38 | return \count($this->messages); |
||
39 | } |
||
40 | |||
41 | public function merge(MessageInterface $message): MessageInterface |
||
51 | } |
||
52 | } |
||
53 |