| Total Complexity | 7 |
| Total Lines | 64 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 11 | class Street extends ValueObject |
||
| 12 | { |
||
| 13 | /** |
||
| 14 | * Internal properties. |
||
| 15 | * |
||
| 16 | * @var string|null |
||
| 17 | */ |
||
| 18 | protected ?string $prefix = null; |
||
| 19 | protected ?string $street = null; |
||
| 20 | protected ?string $number = null; |
||
| 21 | protected ?string $local = null; |
||
| 22 | |||
| 23 | /** |
||
| 24 | * @param array|null $data |
||
| 25 | */ |
||
| 26 | 25 | final public function __construct(?array $data) |
|
| 31 | 25 | ); |
|
| 32 | } |
||
| 33 | |||
| 34 | /** |
||
| 35 | * @return string |
||
| 36 | */ |
||
| 37 | 22 | public function value(): string |
|
| 38 | { |
||
| 39 | 22 | return $this->format(); |
|
| 40 | } |
||
| 41 | |||
| 42 | /** |
||
| 43 | * Sanitize the passed property. |
||
| 44 | * |
||
| 45 | * @param string|null $value |
||
| 46 | * |
||
| 47 | * @return string|null |
||
| 48 | */ |
||
| 49 | 17 | protected function sanitize(?string $value): ?string |
|
| 50 | { |
||
| 51 | 17 | return ! is_null($value) |
|
| 52 | 17 | ? Str::squish($value) |
|
| 53 | 17 | : null; |
|
| 54 | } |
||
| 55 | |||
| 56 | /** |
||
| 57 | * @return string |
||
| 58 | */ |
||
| 59 | 22 | protected function format(): string |
|
| 66 | 22 | ]); |
|
| 67 | } |
||
| 68 | |||
| 69 | /** |
||
| 70 | * @return string |
||
| 71 | */ |
||
| 72 | 22 | public function __toString(): string |
|
| 77 |