public function search(array $search)
    {
        $rows = new Collection();

        if (empty($search)) {
            return $rows;
        }

        foreach ($this->getCart() as $item) {
            if (array_intersect_assoc($item->intersect($search)->toArray(), $search)) {
                $rows->put($item->__raw_id, $item);
            }
        }

        return $rows;
    }
public function search(array $search)
    {
        $rows = new Collection();

        if (empty($search)) {
            return $rows;
        }

        foreach ($this->getCart() as $item) {
            if (array_intersect_assoc($item->intersect($search)->toArray(), $search)) {
                $rows->put($item->__raw_id, $item);
            }
        }

        return $rows;
    }
public function search ( array $ search ) { $ rows = new Collection ( ) ; if ( empty ( $ search ) ) { return $ rows ; } foreach ( $ this -> getCart ( ) as $ item ) { if ( array_intersect_assoc ( $ item -> intersect ( $ search ) -> toArray ( ) , $ search ) ) { $ rows -> put ( $ item -> __raw_id , $ item ) ; } } return $ rows ; }
Search if the cart has a item.

@param array $search An array with the item ID and optional options

@return array
Search if the cart has a item .