| Total Complexity | 6 |
| Total Lines | 56 |
| Duplicated Lines | 0 % |
| Coverage | 83.33% |
| Changes | 6 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 14 | class Uuid extends ValueObject |
||
| 15 | { |
||
| 16 | use Macroable, Conditionable; |
||
| 17 | |||
| 18 | /** |
||
| 19 | * @param string|null $uuid |
||
| 20 | * @param string|null $name |
||
| 21 | */ |
||
| 22 | 8 | public function __construct( |
|
| 23 | protected ?string $uuid, |
||
| 24 | protected ?string $name = null, |
||
| 25 | ) { |
||
| 26 | // |
||
| 27 | } |
||
| 28 | |||
| 29 | /** |
||
| 30 | * @return string |
||
| 31 | */ |
||
| 32 | public function uuid(): string |
||
| 35 | } |
||
| 36 | |||
| 37 | /** |
||
| 38 | * @return string |
||
| 39 | */ |
||
| 40 | 2 | public function name(): string |
|
| 41 | { |
||
| 42 | 2 | return (string) $this->name; |
|
| 43 | } |
||
| 44 | |||
| 45 | /** |
||
| 46 | * @return string |
||
| 47 | */ |
||
| 48 | 6 | public function value(): string |
|
| 49 | { |
||
| 50 | 6 | return (string) $this->uuid; |
|
| 51 | } |
||
| 52 | |||
| 53 | /** |
||
| 54 | * @return array |
||
| 55 | */ |
||
| 56 | 1 | public function toArray(): array |
|
| 57 | { |
||
| 58 | return [ |
||
|
|
|||
| 59 | 1 | 'name' => $this->name(), |
|
| 60 | 1 | 'value' => $this->value(), |
|
| 61 | ]; |
||
| 62 | } |
||
| 63 | |||
| 64 | /** |
||
| 65 | * @return string |
||
| 66 | */ |
||
| 67 | 1 | public function __toString(): string |
|
| 70 | } |
||
| 71 | } |
||
| 72 |
In the issue above, the returned value is violating the contract defined by the mentioned interface.
Let's take a look at an example: