| Conditions | 3 |
| Paths | 3 |
| Total Lines | 15 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 11 |
| CRAP Score | 3 |
| Changes | 0 | ||
| 1 | <?php |
||
| 17 | 4 | public function add($item) |
|
| 18 | { |
||
| 19 | 4 | if ($item instanceof Item) { |
|
| 20 | 1 | $this->items[] = $item; |
|
| 21 | 3 | } elseif ($item instanceof ItemInterface) { |
|
| 22 | 1 | $this->items[] = new Item(array( |
|
| 23 | 1 | 'name' => $item->getName(), |
|
| 24 | 1 | 'description' => $item->getDescription(), |
|
| 25 | 1 | 'quantity' => $item->getQuantity(), |
|
| 26 | 1 | 'price' => $item->getPrice(), |
|
| 27 | )); |
||
| 28 | } else { |
||
| 29 | 2 | $this->items[] = new Item($item); |
|
| 30 | } |
||
| 31 | 4 | } |
|
| 32 | } |
||
| 33 |