limits sequence to the first n elements

This is an intermediate operation.

@param   int  $n
@return  \stubbles\sequence\Sequence
16493
public function limit(int $n): self
    {
        return new self(new Limit($this->getIterator(), 0, $n), $this->type);
    }
947467
public function toASN1(): Sequence
    {
        $elements = array($this->_issuer->toASN1(), new Integer($this->_serial));
        if (isset($this->_issuerUID)) {
            $elements[] = $this->_issuerUID->toASN1();
        }
        return new Sequence(...$elements);
    }
811464
public function writeLongLong($n)
    {
        $this->flushBits();
        $this->out .= implode('', Writer::chrByteSplit($n, 8));
        return $this;
    }
252379
public function writeLong($n)
    {
        $this->flushBits();
        $this->out .= implode('', Writer::chrByteSplit($n, 4));
        return $this;
    }
79141
public function toASN1(): Sequence
    {
        $org = $this->_organization->toASN1();
        $nums = array_map(
            function ($number) {
                return new Integer($number);
            }, $this->_numbers);
        return new Sequence($org, new Sequence(...$nums));
    }
331101
public function first($n)
    {
        $first = '';

        if ($n > 0)
        {
            $first = UTF8::substr
            (
                $this->scalarString,
                0,
                $n,
                $this->encoding
            );
        }

        return $this->newSelf($first);
    }
526392
public function limit($limit = null)
    {
        if (!func_num_args()) {
            return $this->_limit;
        }
        $this->_limit = $limit;
        return $this;
    }
984458
public function allocateTo($n)
    {
        if (!is_int($n)) {
            throw new \InvalidArgumentException('Number of targets must be an integer');
        }

        if ($n <= 0) {
            throw new \InvalidArgumentException('Cannot allocate to none, target must be greater than zero');
        }

        return $this->allocate(array_fill(0, $n, 1));
    }
827919
public function limit($limit = 0)
	{
		if (is_null($this->limit))
		{
			$this->limit = new QueryElement('LIMIT', (int) $limit);
		}

		return $this;
	}
1007437
function nth(int $nth, int $offset = 0) {
        if($nth <= 0) {
            throw new \InvalidArgumentException('nth must be a non-zero positive integer');
        }
        
        $new = array();
        $size = \count($this->data);
        
        for($i = $offset; $i < $size; $i += $nth) {
            $new[] = $this->data[$i];
        }
        
        return (new self($new));
    }
767619
public function blockLimit($number = null)
    {
        $number = $number !== null ? intval($number) : $number;
        $this->_blockLimit = $number;

        return $this;
    }
1285013
function only ($n)
  {
    $this->setIterator ($it = new LoopIterator ($this->getIterator ()));
    $it->limit ($n);
    return $this;
  }
1137705
public function toASN1(): Sequence
    {
        return new Sequence($this->_acinfo->toASN1(),
            $this->_signatureAlgorithm->toASN1(),
            $this->_signatureValue->bitString());
    }
1254944
public function toASN1(): Sequence
    {
        return new Sequence($this->_tbsCertificate->toASN1(),
            $this->_signatureAlgorithm->toASN1(),
            $this->_signatureValue->bitString());
    }
575903
public function getParent($n = null)
	{
		return ($n > 1) ? $this->parent->getParent(--$n) : $this->parent;
	}
555347
public function limit(int $number)
    {
        $instance = $this->limitStrategyInstance();

        $instance->limitStrategy()->limit($number);

        return $instance;
    }
970338
private function fromZigZag($n)
    {
        if (PHP_INT_SIZE === 4) {
            $n = gmp_init($n, 10);
        }
        $result = ($n >> 1) ^ -($n & 1);
        if (PHP_INT_SIZE === 4) {
            $result = gmp_strval($result, 10);
        }

        return $result;
    }