| Conditions | 4 |
| Paths | 5 |
| Total Lines | 18 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 9 |
| CRAP Score | 4 |
| Changes | 0 | ||
| 1 | <?php |
||
| 51 | 4 | public function pipeline($builder) : self |
|
| 52 | { |
||
| 53 | 4 | if (! $this->field) { |
|
| 54 | 1 | throw new LogicException(__METHOD__ . ' requires you set a current field using field().'); |
|
| 55 | } |
||
| 56 | |||
| 57 | 3 | if ($builder instanceof Stage) { |
|
| 58 | 2 | $builder = $builder->builder; |
|
| 59 | } |
||
| 60 | |||
| 61 | 3 | if (! $builder instanceof Builder) { |
|
| 62 | 1 | throw new InvalidArgumentException(__METHOD__ . ' expects either an aggregation builder or an aggregation stage.'); |
|
| 63 | } |
||
| 64 | |||
| 65 | 2 | $this->pipelines[$this->field] = $builder; |
|
| 66 | |||
| 67 | 2 | return $this; |
|
| 68 | } |
||
| 69 | } |
||
| 70 |