Set the total number of items (for counting pages).

@param  integer $total The total number of items.
@throws InvalidArgumentException If the argument is not a number or lower than 0.
@return self
772959
public function setNumTotal($total)
    {
        if (!is_numeric($total)) {
            throw new InvalidArgumentException(
                'Total Number must be numeric.'
            );
        }

        $total = (int)$total;
        if ($total < 0) {
            throw new InvalidArgumentException(
                'Total Number must be greater than zero.'
            );
        }

        $this->numTotal = $total;

        return $this;
    }
283621
final public function setLevel($level)
    {
        if (!in_array(strtolower($level), $this->getAllowedLevel())) {
            throw new InvalidArgumentException();
        }

        $this->level = $level;

        return $this;
    }
705282
public function setTotal($total)
    {
        NumericValidator::validate($total, "Total");
        $total = Formatter::formatToPrice($total, $this->getCurrency());
        $this->total = $total;
        return $this;
    }
1111903
public function setNumTotalResults( $total )
	{
		$total = (int)$total;
		if ( $total < 0 )
		{
			trigger_error( 'Pagination setNumTotalResults: Total must be positive.' );
			return false;
		}

		$this->items_total = $total;
	}
1000163
public function nth($position)
    {
        if ($position < 0) {
            $position = $this->count() + $position;
        }
        if ($position < 0 || $this->count() < $position) {
            throw new \InvalidArgumentException('Invalid Position');
        }

        $slice = array_slice($this->items, $position, 1);
        return empty($slice) ? null : reset($slice);
    }
1134959
private function setTotalItems($totalItems)
    {
        if (! is_int($totalItems)) {
            throw new Exceptions\InvalidIntegerType(gettype($totalItems));
        }

        // A result may have zero or more items
        if ($totalItems < 0) {
            throw new Exceptions\PositiveIntegerRequired($totalItems);
        }

        $this->totalItems = $totalItems;

        $this->changedTotalItems();
    }
588606
public function setUserRatingCount($userRatingCount)
    {
        $userRatingCount = (int) $userRatingCount;

        if ($userRatingCount < 0) {
            throw new \InvalidArgumentException(sprintf(
                'User rating can\'t be less than "0", "%s" given.',
                $userRatingCount
            ));
        }

        $this->userRatingCount = (int) $userRatingCount;

        return $this;
    }
1316157
public function set_count($try, $count) {
        $this->totalcount = $this->totalcount + $count;
        $this->trycount[$try] = $count;
    }
442139
public function setDelay($delay)
    {
        if (!ctype_digit((string) $delay)) {
            throw new \InvalidArgumentException('Delay must be a number.');
        }
        $this->delay = $delay;

        return $this;
    }
702838
public function setTotalNumberOfPage($number = null)
    {
        if (is_null($number)) {
            $numRecords = $this->model->select($this->count().' AS '.$this->numCount)->findOne();
            $this->totalNumOfPage = $numRecords[0]->{$this->numCount};

            return $this;
        }

        $this->totalNumOfPage = $number;

        return $this;
    }
1354190
public function set($requiredType)
    {
        if (!in_array($requiredType, $this->validTypes)) {
            throw new \InvalidArgumentException("{$requiredType} is not a supported number type");
        }
        if ($requiredType == self::TYPE_GMP && !extension_loaded('gmp')) {
            throw new \InvalidArgumentException('GMP not supported');
        }

        $this->requiredType = $requiredType;

        return $this;
    }
6896
public function updateTotal(&$total) {
        $rate = (float)self::config()->get('tax_rate') / 100;
        $tax = $total * $rate;
        $this->setPriceModification($tax);
        if (!(bool)self::config()->get('inclusive')) {
            $total += $tax;
        }
    }
1207203
private function setCount(int $count): self
    {
        $this->count = max($count, 0);
        if ($this->count > 0) {
            $this->countPages = (int)ceil($this->count / $this->limit);
        } else {
            $this->countPages = 1;
        }

        return $this;
    }
1166803
public function setCount(int $count, string $type = self::INFO): void
	{
		if ($count > 0) {
			switch ($type) {
				default:
					throw new InvalidArgumentException("Wrong argument 'type'");
				case self::INFO:
				case self::WARNING:
					break;
			}
			$this->count = $count;
			$this->type = $type;
		}
	}
1305616
public function setTotalPrice(Money $totalPrice = null)
    {
        $this->totalPrice = $totalPrice ? $totalPrice->getAmount() : $totalPrice;

        return $this;
    }
956581
public function setNumPerPage($count)
    {
        if (!is_numeric($count)) {
            throw new InvalidArgumentException(
                'Number Per Page must be numeric.'
            );
        }

        $count = (int)$count;
        if ($count < 0) {
            throw new InvalidArgumentException(
                'Number Per Page must be greater than zero.'
            );
        }

        $this->numPerPage = $count;
        return $this;
    }
101728
public function getCurrentPage($total = null)
    {
        $page = abs(app()->request->get('page', 1));

        if ($total) {
            $this->total = $total;
        }

        $page >= 1 || $page = 1;

        if ($this->items) {
            $totalPage = $this->getTotalPage();
            $page <= $totalPage || $page = $totalPage;
        }

        return $page;
    }