| 1 | <?php |
||
| 9 | class SelfValidatedUuid implements ConvertibleToString, \JsonSerializable |
||
| 10 | { |
||
| 11 | private |
||
| 12 | $uuid; |
||
|
|
|||
| 13 | |||
| 14 | 12 | public function __construct(?string $uuid = null) |
|
| 27 | |||
| 28 | 7 | public function value(): string |
|
| 32 | |||
| 33 | 5 | public function equals(SelfValidatedUuid $uuid): bool |
|
| 34 | { |
||
| 35 | 5 | return $this->uuid === $uuid->value(); |
|
| 36 | } |
||
| 37 | |||
| 38 | 1 | public function __toString(): string |
|
| 42 | |||
| 43 | 8 | private function validateUuid(string $string): void |
|
| 57 | |||
| 58 | 1 | public function jsonSerialize() |
|
| 62 | } |
||
| 63 |
The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using
the property is implicitly global.
To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2.