Load each model instance, grouped by class.

@param array $items

@return array
347861
private function loadModels(array $items)
    {
        $classes = [];
        $results = [];

        // Retrieve a list of keys to load from each class.
        foreach ($items as $item) {
            if (!is_null($item['key'])) {
                $classes[$item['class']][] = $item['key'];
            }
        }

        // Iterate list of classes and load all records matching a key.
        foreach ($classes as $class => $keys) {
            $model = new $class();
            $results[$class] = $model->whereIn($model->getKeyName(), $keys)->get()->keyBy($model->getKeyName());
        }

        return $results;
    }
1016770
public function fromItems(array $items): array
    {
        $objects = [];
        foreach ($items as $item) {
            $objects[] = $this->fromItem($item);
        }

        return $objects;
    }
865453
protected function getArrayableItems($items)
    {
        if (is_array($items)) {
            return $items;
        }

        if ($items instanceof Traversable) {
            return iterator_to_array($items);
        }

        return (array) $items;
    }
255448
protected function getArrayableItems($items)
	{
		if ($items instanceof Collection)
		{
			$items = $items->all();
		}
		elseif ($items instanceof Arrayable)
		{
			$items = $items->toArray();
		}

		return $items;
	}
941905
protected function prepareArrays(array $items = [])
    {
        $items = array_map(function ($item) {
            return trim($item);
        }, $items);

        return array_filter($items, function ($item) {
            return ! empty($item);
        });
    }
1336052
private function _build_items(array $items)
	{
		foreach ($items as $key => $item) {
			$this->_items[$key] = new Element_Item($item, $this, $key);
		}

		return $this;
	}
690878
protected function setCartItems($items)
    {
        return (new Collection($items))->map(function ($item, $num) {
            return [
                'L_PAYMENTREQUEST_0_NAME'.$num => $item['name'],
                'L_PAYMENTREQUEST_0_AMT'.$num  => $item['price'],
                'L_PAYMENTREQUEST_0_QTY'.$num  => isset($item['qty']) ? $item['qty'] : 1,
            ];
        })->flatMap(function ($value) {
            return $value;
        });
    }
480447
public function getTickets($items)
  {
    if (!count($items)) {
      return [];
    }

    $result = [];
    foreach ($items as $item) {
      $result[] = new Ticket($item);
    }

    return $result;
  }
721107
protected function initItems(array $items)
    {
        foreach ($items as $k => $item) {
            if (!$item instanceof AbstractEntity) {
                throw new \InvalidArgumentException('Item ' . $k . ' is not an instance of ' . AbstractEntity::class);
            }
            $this->items[$item->getId()] = $item;
        }

        \uasort($this->items, function (AbstractEntity $item1, AbstractEntity $item2) {
            return $item1->get($this->sortField) <=> $item2->get($this->sortField);
        });

        foreach ($this->items as $item) {
            $id = $item->getId();
            $parentId = $item->get($this->parentField);
            $this->parentIds[$id] = $parentId;
            isset($this->childrenIds[$parentId])
                ? $this->childrenIds[$parentId][] = $id
                : $this->childrenIds[$parentId] = [$id];

            if (!$parentId) {
                $this->root[] = $item->getId();
            }
        }
    }
172618
protected function getItems($items)
    {
        if (\is_array($items)) {
            return $items;
        } elseif ($items instanceof self) {
            return $items->all();
        } elseif ($items instanceof Traversable) {
            return \iterator_to_array($items);
        }
        return (array) $items;
    }
757110
protected function getArrayableItems($items)
		{
			if ($items instanceof self) {
				$items = $items->all();
			} elseif ($items instanceof Arrayable) {
				$items = $items->toArray();
			}

			return $items;
		}
1006114
public function setItems($items)
    {
        $newItems = new ItemBag();
        foreach ($items as $item) {
            $newItems->add(new Item($item->getParameters()));
        }

        return parent::setItems($newItems);
    }
164017
protected function getItems(array $items)
	{
		$result = array();
		foreach($items as $item) {
			$result[] = $this->getItem($item);
		}
		return $result;
	}
8227
public function filter(array $items): array
    {
        foreach ($this->filter as $filter) {
            $items = $filter->filter($items);
        }

        return $items;
    }
1278706
public function getDictionary($items = null)
    {
        $items = is_null($items) ? $this->items : $items;

        $dictionary = array();

        foreach ($items as $value) {
            $dictionary[$value->getKey()] = $value;
        }

        return $dictionary;
    }
147051
protected function getArrayableItems($items)
    {
        if (is_array($items)) {
            return $items;
        }
        if ($items instanceof self) {
            return $items->all();
        }
        if (is_object($items) && method_exists($items, 'toArray')) {
            return $items->toArray();
        }
        if (is_object($items) && method_exists($items, 'toJson')) {
            return json_decode($items->toJson(), true);
        }
        if ($items instanceof JsonSerializable) {
            return $items->jsonSerialize();
        }
        if ($items instanceof Traversable) {
            return iterator_to_array($items);
        }

        return (array) $items;
    }
1166136
protected function processItems(array $items)
    {
        $processedItems = [];

        foreach ($items as $entry) {
            $processedItems[] = new Account($entry);
        }

        return $processedItems;
    }