public function slice($offset, $length = null)
    {
        $keys = $this->getKeys();

        $keys = array_slice($keys, $offset, $length);

        $collection = $this->getNewCollection();

        foreach ($this as $key => $entity) {
            if (in_array($key, $keys)) {
                $collection[$key] = $entity;
            }
        }

        return $collection;
    }
public function slice($offset, $length = null)
    {
        $keys = $this->getKeys();

        $keys = array_slice($keys, $offset, $length);

        $collection = $this->getNewCollection();

        foreach ($this as $key => $entity) {
            if (in_array($key, $keys)) {
                $collection[$key] = $entity;
            }
        }

        return $collection;
    }
public function slice ( $ offset , $ length = null ) { $ keys = $ this -> getKeys ( ) ; $ keys = array_slice ( $ keys , $ offset , $ length ) ; $ collection = $ this -> getNewCollection ( ) ; foreach ( $ this as $ key => $ entity ) { if ( in_array ( $ key , $ keys ) ) { $ collection [ $ key ] = $ entity ; } } return $ collection ; }
Extract a slice of the collection

@param integer $offset
@param integer|null $length

@return static
Extract a slice of the collection