{@inheritdoc}

@return CollectionInterface|static
174879
public function chunk(int $size): CollectionInterface
    {
        if ($size <= 0) {
            return new static();
        }

        $chunks = [];

        foreach (array_chunk($this->data->getValues(), $size, true) as $chunk) {
            $chunks[] = new static($chunk);
        }

        return new static($chunks);
    }
153025
public static function get($params = array())
	{
		$object = new static;
		$data   = $object->request('GET', $object->getUrl(), $params);
		$data   = $object->stripResponseData($data);

		// Initialise a collection
		$collection = self::newCollection();

		if (isset($data[0]) && is_array($data[0])) {
			// This should be a collection
			$collection->setItems($data);
		}

		return $collection;
	}
629078
public function resolveCollection($collection, $request = null)
    {
        return $collection->map(function ($item) use ($request) {
            return (new static($item))->toArray($request);
        })->all();
    }
772504
public static function createCollection($options)
    {
        $defaultConfig = isset(static::$collectionConfig['default'])
            ? static::$collectionConfig['default']
            : array();

        $config = null;

        if (isset(static::$collectionConfig['mapping'][$options['name']])) {
            $config =static::$collectionConfig['mapping'][$options['name']];
        } else {
            if (isset(static::$collectionConfig['resolvers']) and is_array(static::$collectionConfig['resolvers'])) {
                foreach (static::$collectionConfig['resolvers'] as $resolver => $resolverOpts) {
                    if (is_string($resolverOpts)) {
                        $resolver = $resolverOpts;
                        $resolverOpts = array();
                    }

                    $resolver = new $resolver($resolverOpts);
                    $config = $resolver->resolve($options);

                    if (isset($config)) {
                        break;
                    }
                }
            }
        }


        if (!isset($config)) {
            $config = array();
        }

        $config = array_merge_recursive($defaultConfig, $config);

        $options = array_merge_recursive($config, $options);

        if (isset($options['collection'])) {
            $Driver = $options['collection'];
            $collection = new $Driver($options);
        } else {
            $collection = new Collection($options);
        }

        return $collection;
    }
565590
public function get($collection)
    {
        $collection = $this->makeCollection($collection);

        $url      = UrlHelper::buildUrl(Urls::URL_COLLECTION, [$collection]);
        $response = $this->getConnection()->get($url);

        $data = $response->getJson();

        return Collection::createFromArray($data);
    }
1224924
public function zip($items): CollectionInterface
    {
        $items = array_map(function ($items) {
            if ($items instanceof IteratorAggregate) {
                return $items->getIterator();
            }

            if (is_array($items)) {
                return new ArrayIterator($items);
            }

            return $items;
        }, func_get_args());

        return $this->wrap(function (Iterator $data) use ($items) {
            foreach ($data as $key => $datum) {
                $result = [$datum];

                /** @var Iterator $item */
                foreach ($items as $item) {
                    $result[] = $item->current();
                    $item->next();
                }

                yield $key => $this::make($result);
            }
        });
    }
617094
public function intersect($collection)
    {
        $intersection = new DefaultCollection();
        /** @var ModelInterface $localModel */
        foreach ($this as $localModel) {
            /** @var ModelInterface $otherModel */
            foreach ($collection as $otherModel) {
                if (($localModel->getProviderName() === $otherModel->getProviderName())
                    && ($localModel->getId() === $otherModel->getId())
                ) {
                    $intersection->push($localModel);
                }
            }
        }

        return $intersection;
    }
1335911
protected function getCollectionManager()
    {
        return $this->getPrototype(
            $this->collectionManagerClass,
            ['umi\orm\collection\ICollectionManager']
        )
            ->createSingleInstance(
                [
                    $this->getObjectCollectionFactory(),
                    $this->collections
                ]
            );
    }
1220257
public function copy(): Collection
    {
        $items = $this->items;
        $resolver = $this->resolver;

        return new static($items, $resolver);
    }
289629
public function setCollection($collection)
    {
        $this->indexedContainer = $collection;

        foreach ($collection as $argModel) {
            $this->hashedContainer[$argModel->getName()] = $argModel;
        }

        return $this;
    }
396985
public function setCollection($collection)
    {
        $this->collection = (array) $collection;
        $this->setCount(count($this->collection));

        return $this;
    }
759337
public function collection($collectionId)
    {
        return new CollectionReference(
            $this->connection,
            $this->valueMapper,
            $this->childPath($this->name, $collectionId)
        );
    }
321047
public function remove($key): CollectionInterface
    {
        foreach ($this->indexes as $index) {
            $index->remove($key);
        }

        return parent::remove($key);
    }
609699
public function createMany(): Collection
	{
		$collection = new Collection();

		foreach ($this->getInput() as $item) {
			$repository = clone $this;
			$repository->setInput($item);
			$collection->add($repository->create());
		}

		return $collection;
	}
1122318
protected function collectionLoader()
    {
        if ($this->collectionLoader === null) {
            $this->collectionLoader = $this->createCollectionLoader();
        }

        return $this->collectionLoader;
    }
1203124
protected function getCollectionFromObjectByValue()
    {
        $object = $this->getObject();
        $getter = 'get' . Inflector::classify($this->getCollectionName());

        if (! method_exists($object, $getter)) {
            throw new InvalidArgumentException(
                sprintf(
                    'The getter %s to access collection %s in object %s does not exist',
                    $getter,
                    $this->getCollectionName(),
                    get_class($object)
                )
            );
        }

        return $object->$getter();
    }
7359
protected function collectionLoader()
    {
        if ($this->collectionLoader === null) {
            throw new RuntimeException(sprintf(
                'Collection Loader is not defined for "%s"',
                get_class($this)
            ));
        }

        return $this->collectionLoader;
    }