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