| Total Complexity | 8 |
| Total Lines | 44 |
| Duplicated Lines | 0 % |
| Coverage | 88.24% |
| Changes | 0 | ||
| 1 | <?php |
||
| 11 | class MultipleErrors extends InvalidEmail |
||
| 12 | { |
||
| 13 | /** |
||
| 14 | * @var Reason[] |
||
| 15 | */ |
||
| 16 | private $reasons = []; |
||
| 17 | |||
| 18 | 11 | public function __construct() |
|
| 19 | { |
||
| 20 | 11 | } |
|
| 21 | |||
| 22 | 10 | public function addReason(Reason $reason) : void |
|
| 23 | { |
||
| 24 | 10 | $this->reasons[$reason->code()] = $reason; |
|
| 25 | } |
||
| 26 | |||
| 27 | /** |
||
| 28 | * @return Reason[] |
||
| 29 | */ |
||
| 30 | 2 | public function getReasons() : array |
|
| 31 | { |
||
| 32 | 2 | return $this->reasons; |
|
| 33 | } |
||
| 34 | |||
| 35 | 4 | public function reason() : Reason |
|
| 36 | { |
||
| 37 | 4 | return 0 !== count($this->reasons) |
|
| 38 | 3 | ? current($this->reasons) |
|
| 39 | 4 | : new EmptyReason(); |
|
| 40 | } |
||
| 41 | |||
| 42 | 1 | public function description() : string |
|
| 50 | } |
||
| 51 | |||
| 52 | public function code() : int |
||
| 55 | } |
||
| 56 | } |
||
| 57 |