public function setItems($list)
    {
        if (!is_array($list)) {
            $this->items = null;

            return;
        }

        $items = [];
        foreach ($list as $index => $element) {
            if ((!is_object($element) || !($element instanceof \ShopgateOrderItem)) && !is_array($element)) {
                unset($list[$index]);
                continue;
            }

            if ($element instanceof \ShopgateOrderItem) {
                $element = $element->toArray();
            }

            $item = $this->itemFactory->create();
            $item->loadArray($element);
            $items[$item->getItemNumber()] = $item;
        }

        $this->items = $items;
    }
public function setItems($list)
    {
        if (!is_array($list)) {
            $this->items = null;

            return;
        }

        $items = [];
        foreach ($list as $index => $element) {
            if ((!is_object($element) || !($element instanceof \ShopgateOrderItem)) && !is_array($element)) {
                unset($list[$index]);
                continue;
            }

            if ($element instanceof \ShopgateOrderItem) {
                $element = $element->toArray();
            }

            $item = $this->itemFactory->create();
            $item->loadArray($element);
            $items[$item->getItemNumber()] = $item;
        }

        $this->items = $items;
    }
public function setItems ( $ list ) { if ( ! is_array ( $ list ) ) { $ this -> items = null ; return ; } $ items = [ ] ; foreach ( $ list as $ index => $ element ) { if ( ( ! is_object ( $ element ) || ! ( $ element instanceof \ ShopgateOrderItem ) ) && ! is_array ( $ element ) ) { unset ( $ list [ $ index ] ) ; continue ; } if ( $ element instanceof \ ShopgateOrderItem ) { $ element = $ element -> toArray ( ) ; } $ item = $ this -> itemFactory -> create ( ) ; $ item -> loadArray ( $ element ) ; $ items [ $ item -> getItemNumber ( ) ] = $ item ; } $ this -> items = $ items ; }
Rewrite of the original just to
swap out the objects into our
custom item classes

@param OrderItem[] | null $list
Rewrite of the original just to swap out the objects into our custom item classes