Conditions | 4 |
Paths | 4 |
Total Lines | 21 |
Code Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
11 | public function addStep(StepInterface $step, $before = null) |
||
12 | { |
||
13 | |||
14 | if ($before === null) { |
||
15 | $this->steps[] = $step; |
||
16 | return; |
||
17 | } |
||
18 | $key = array_search($before, $this->steps); |
||
19 | $stepCount = count($this->steps); |
||
20 | if ($key !== false) { |
||
21 | $steps = array_slice($this->steps, 0, $key); |
||
22 | $steps[] = $step; |
||
23 | for ($i = $key; $i < $stepCount; $i++) { |
||
24 | $steps[] = $this->steps[$i]; |
||
25 | } |
||
26 | $this->steps = $steps; |
||
27 | } else { |
||
28 | $this->steps[] = $step; |
||
29 | } |
||
30 | |||
31 | } |
||
32 | |||
55 | } |