YaLinqo\Enumerable::tryGetArrayCopy PHP Method

tryGetArrayCopy() protected method

protected tryGetArrayCopy ( )
    protected function tryGetArrayCopy()
    {
        /** @var $it \Iterator|\ArrayIterator */
        $it = $this->iterator;
        return $it instanceof \ArrayIterator ? $it->getArrayCopy() : null;
    }

Usage Example

Example #1
0
 /** {@inheritdoc} */
 public function getIterator()
 {
     $canMultisort = $this->sortFlags !== null;
     $array = $this->source->tryGetArrayCopy();
     $it = $this->trySortBySingleField($array, $canMultisort);
     if ($it !== null) {
         return $it;
     }
     return $this->sortByMultipleFields($array, $canMultisort);
 }