Conditions | 4 |
Paths | 2 |
Total Lines | 23 |
Code Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 20 |
Changes | 1 | ||
Bugs | 1 | Features | 0 |
1 | <?php |
||
18 | public function render(State $state) |
||
19 | { |
||
20 | $graph = ''; |
||
21 | $color = static::COMMAND_COLOR; |
||
22 | |||
23 | if ($state->getTransitions()) { |
||
24 | foreach ($state->getTransitions() as $transition) { |
||
25 | /** |
||
26 | * @var State $targetState |
||
27 | */ |
||
28 | $targetState = $transition->getObj(); |
||
29 | if ($targetState->getKey() === $state->getKey()) { |
||
30 | $graph .= ' edge[dir="back",style="solid",color="' . $color . '"] state_' |
||
31 | . $state->getKey() . ' -> state_' . $state->getKey() . ';' . PHP_EOL; |
||
32 | } else { |
||
33 | $graph .= ' edge[dir="forward",style="solid",color="' . $color . '"] state_' |
||
34 | . $state->getKey() . ' -> state_' . $targetState->getKey() . ' ;' . PHP_EOL; |
||
35 | } |
||
36 | } |
||
37 | } |
||
38 | |||
39 | return $graph; |
||
40 | } |
||
41 | } |
||
42 |