Conditions | 3 |
Paths | 3 |
Total Lines | 15 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 1 | Features | 0 |
1 | <?php declare(strict_types=1); |
||
34 | public static function fromString(string $name): self |
||
35 | { |
||
36 | $allowedStates = [ |
||
37 | self::BLOCKED, |
||
38 | self::DELETED, |
||
39 | self::NEW, |
||
40 | self::OK, |
||
41 | ]; |
||
42 | foreach ($allowedStates as $state) { |
||
43 | if ($state === $name) { |
||
44 | return new self($state); |
||
45 | } |
||
46 | } |
||
47 | |||
48 | throw new \Exception("wrong customer state '$name'"); |
||
49 | } |
||
51 |