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); |
||
49 | public static function fromString(string $name): self |
||
50 | { |
||
51 | $allowedStates = [ |
||
52 | self::BLOCKED, |
||
53 | self::DELETED, |
||
54 | self::NEW, |
||
55 | self::OK, |
||
56 | ]; |
||
57 | foreach ($allowedStates as $state) { |
||
58 | if ($state === $name) { |
||
59 | return new self($state); |
||
60 | } |
||
61 | } |
||
62 | |||
63 | throw new \Exception("wrong customer state '$name'"); |
||
64 | } |
||
66 |