| Total Complexity | 10 |
| Total Lines | 59 |
| Duplicated Lines | 0 % |
| Changes | 5 | ||
| Bugs | 1 | Features | 2 |
| 1 | <?php declare(strict_types=1); |
||
| 7 | class CustomerState |
||
| 8 | { |
||
| 9 | public const BLOCKED = 'blocked'; |
||
| 10 | |||
| 11 | public const DELETED = 'deleted'; |
||
| 12 | |||
| 13 | public const NEW = 'new'; |
||
| 14 | |||
| 15 | public const OK = 'ok'; |
||
| 16 | |||
| 17 | private function __construct(protected string $state = self::NEW) |
||
| 18 | { |
||
| 19 | } |
||
| 20 | |||
| 21 | public function getName(): string |
||
| 24 | } |
||
| 25 | |||
| 26 | public static function isDeleted(CustomerInterface $customer): bool |
||
| 29 | } |
||
| 30 | |||
| 31 | public static function deleted(): CustomerState |
||
| 32 | { |
||
| 33 | return new self(self::DELETED); |
||
| 34 | } |
||
| 35 | |||
| 36 | public static function blocked(): CustomerState |
||
| 37 | { |
||
| 38 | return new self(self::BLOCKED); |
||
| 39 | } |
||
| 40 | |||
| 41 | public static function new(): CustomerState |
||
| 44 | } |
||
| 45 | |||
| 46 | public static function ok(): CustomerState |
||
| 47 | { |
||
| 48 | return new self(self::OK); |
||
| 49 | } |
||
| 50 | |||
| 51 | public static function fromString(string $name): self |
||
| 66 | } |
||
| 67 | } |
||
| 68 |