function addItem($item) { if ($item != null && is_object($item) && $item instanceof Item) { $this->items[] = $item; } }