public function limit(int $limit): self
    {
        if (-1 > $limit) {
            throw new Exception(sprintf('%s() expects the limit to be greater or equal to -1, %s given', __METHOD__, $limit));
        }

        if ($limit === $this->limit) {
            return $this;
        }

        $clone = clone $this;
        $clone->limit = $limit;

        return $clone;
    }
public function limit(int $limit): self
    {
        if (-1 > $limit) {
            throw new Exception(sprintf('%s() expects the limit to be greater or equal to -1, %s given', __METHOD__, $limit));
        }

        if ($limit === $this->limit) {
            return $this;
        }

        $clone = clone $this;
        $clone->limit = $limit;

        return $clone;
    }
public function limit ( int $ limit ) : self { if ( - 1 > $ limit ) { throw new Exception ( sprintf ( '%s() expects the limit to be greater or equal to -1, %s given' , __METHOD__ , $ limit ) ) ; } if ( $ limit === $ this -> limit ) { return $ this ; } $ clone = clone $ this ; $ clone -> limit = $ limit ; return $ clone ; }
Set LimitIterator Count.

@throws Exception if the limit is lesser than -1
Set LimitIterator Count .