Conditions | 2 |
Paths | 2 |
Total Lines | 16 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
15 | static public function get($state) |
||
16 | { |
||
17 | $states = [ |
||
18 | WaitingPayment::CODE => new WaitingPayment(), |
||
19 | InAnalysis::CODE => new InAnalysis(), |
||
20 | PaidState::CODE => new PaidState(), |
||
21 | AvailableState::CODE => new AvailableState(), |
||
22 | ContestState::CODE => new ContestState(), |
||
23 | ReturnedState::CODE => new ReturnedState(), |
||
24 | CancelledState::CODE => new CancelledState(), |
||
25 | DebitedState::CODE => new DebitedState() |
||
26 | ]; |
||
27 | if (!array_key_exists($state, $states)) { |
||
28 | throw new StateException('Unknow State'); |
||
29 | } |
||
30 | return $states[$state]; |
||
31 | } |
||
32 | } |