| Conditions | 6 |
| Paths | 6 |
| Total Lines | 19 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 42 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 25 | public function collect($source, DateTimeImmutable $time = null): OrderInterface |
||
| 26 | { |
||
| 27 | if ($source instanceof OrderInterface) { |
||
| 28 | return $source; |
||
| 29 | } |
||
| 30 | if ($source instanceof ActionInterface) { |
||
| 31 | return Order::fromAction($source); |
||
| 32 | } |
||
| 33 | if (is_array($source)) { |
||
| 34 | $item = reset($source); |
||
| 35 | if ($item instanceof OrderInterface) { |
||
| 36 | return $this->mergeOrders($source); |
||
| 37 | } |
||
| 38 | if ($item instanceof ActionInterface) { |
||
| 39 | return Order::fromActions($source); |
||
| 40 | } |
||
| 41 | } |
||
| 42 | |||
| 43 | throw new NotSupportedException('unknown order source'); |
||
| 44 | } |
||
| 56 |