| Total Complexity | 9 |
| Total Lines | 51 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 14 | class PostalCode implements AddressElement |
||
| 15 | { |
||
| 16 | /** @var string */ |
||
| 17 | private $value; |
||
| 18 | |||
| 19 | /** |
||
| 20 | * @throws \InvalidArgumentException |
||
| 21 | */ |
||
| 22 | public function __construct(string $value) |
||
| 23 | { |
||
| 24 | $this->setValue($value); |
||
| 25 | } |
||
| 26 | |||
| 27 | private function setValue(string $value) : void |
||
| 35 | } |
||
| 36 | |||
| 37 | public function getValue() : string |
||
| 38 | { |
||
| 39 | return $this->value; |
||
| 40 | } |
||
| 41 | |||
| 42 | public function equals(?ValueObject $object) : bool |
||
| 43 | { |
||
| 44 | if (!$object instanceof self) { |
||
| 45 | return false; |
||
| 46 | } |
||
| 47 | |||
| 48 | return $object->getValue() === $this->getValue(); |
||
| 49 | } |
||
| 50 | |||
| 51 | public function getFormatted() : string |
||
| 52 | { |
||
| 53 | return sprintf('%s', $this->getValue()); |
||
| 54 | } |
||
| 55 | |||
| 56 | public function __toString() : string |
||
| 59 | } |
||
| 60 | |||
| 61 | public function jsonSerialize() |
||
| 62 | { |
||
| 63 | return [ |
||
| 68 |