| Conditions | 3 |
| Paths | 3 |
| Total Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 10 |
| CRAP Score | 3 |
| Changes | 0 | ||
| 1 | <?php |
||
| 15 | 10 | public function selectTransition(\Traversable $transitions) |
|
| 16 | { |
||
| 17 | 10 | $transitions = iterator_to_array($transitions); |
|
| 18 | |||
| 19 | 10 | switch (count($transitions)) { |
|
| 20 | 10 | case 0: |
|
| 21 | 3 | return; |
|
| 22 | 10 | case 1: |
|
| 23 | 8 | return reset($transitions); |
|
| 24 | 2 | default: |
|
| 25 | 2 | throw new \RuntimeException('More than one transition is active!'); |
|
| 26 | 2 | } |
|
| 27 | } |
||
| 28 | } |
||
| 29 |