protected function createFrom(array $elements, $keyField = null)
    {
        $collection = new static($elements, $this->_flexDirectory);
        $collection->setKeyField($keyField ?: $this->_keyField);

        return $collection;
    }
protected function createFrom(array $elements, $keyField = null)
    {
        $collection = new static($elements, $this->_flexDirectory);
        $collection->setKeyField($keyField ?: $this->_keyField);

        return $collection;
    }
protected function createFrom ( array $ elements , $ keyField = null ) { $ collection = new static ( $ elements , $ this -> _flexDirectory ) ; $ collection -> setKeyField ( $ keyField ? : $ this -> _keyField ) ; return $ collection ; }
Creates a new instance from the specified elements.

This method is provided for derived classes to specify how a new
instance should be created when constructor semantics have changed.

@param array $elements Elements.
@param string|null $keyField

@return static
@throws \InvalidArgumentException
Creates a new instance from the specified elements .