| Total Complexity | 5 |
| Total Lines | 51 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 12 | class Uuid extends ValueObject |
||
| 13 | { |
||
| 14 | /** |
||
| 15 | * Create a new instance of the value object. |
||
| 16 | * |
||
| 17 | * @param string|null $uuid |
||
| 18 | * @param string|null $name |
||
| 19 | */ |
||
| 20 | 11 | public function __construct( |
|
| 21 | protected ?string $uuid, |
||
| 22 | protected ?string $name = null, |
||
| 23 | ) { |
||
| 24 | // |
||
| 25 | } |
||
| 26 | |||
| 27 | /** |
||
| 28 | * @return string |
||
| 29 | */ |
||
| 30 | 1 | public function uuid(): string |
|
| 31 | { |
||
| 32 | 1 | return $this->value(); |
|
| 33 | } |
||
| 34 | |||
| 35 | /** |
||
| 36 | * @return string |
||
| 37 | */ |
||
| 38 | 2 | public function name(): string |
|
| 41 | } |
||
| 42 | |||
| 43 | /** |
||
| 44 | * Get the object value. |
||
| 45 | * |
||
| 46 | * @return string |
||
| 47 | */ |
||
| 48 | 9 | public function value(): string |
|
| 51 | } |
||
| 52 | |||
| 53 | /** |
||
| 54 | * Get an array representation of the value object. |
||
| 55 | * |
||
| 56 | * @return array |
||
| 57 | */ |
||
| 58 | 1 | public function toArray(): array |
|
| 63 | ]; |
||
| 64 | } |
||
| 66 |
In the issue above, the returned value is violating the contract defined by the mentioned interface.
Let's take a look at an example: