| Conditions | 2 |
| Paths | 2 |
| Total Lines | 14 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 6 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 25 | public function pipe(callable $stage) |
||
| 26 | { |
||
| 27 | $stages = $this->stages; |
||
| 28 | if ( ! empty($stages)) { |
||
| 29 | end($this->stages); |
||
| 30 | $lastStageIndex = key($this->stages); |
||
| 31 | reset($this->stages); |
||
| 32 | $stages[] = [$stage, $lastStageIndex]; |
||
| 33 | } else { |
||
| 34 | $stages[] = [$stage]; |
||
| 35 | } |
||
| 36 | |||
| 37 | return new static($stages); |
||
| 38 | } |
||
| 39 | |||
| 70 |