/** * Return a number within a range. * * @return integer */ protected function bound() { $number = $this->getParameter('number'); $min = $this->getParameter('min'); $max = $this->getParameter('max'); if ($number instanceof Meta) { $number = $number->getValue(); } return NumberUtils::bound($number, $min, $max); }
/** * Return a sanitized per page number. Is guaranteed to be * between 25 and 1000 (unless a different min/max is supplied). * * @return integer */ protected function sanitizePerPage() { $perPage = $this->getParameter('perPage'); $min = $this->getParameter('min'); $max = $this->getParameter('max'); if (null === $min) { $min = 25; } if (null === $max) { $max = 1000; } return NumberUtils::bound($perPage, $min, $max); }
/** * @param int $ttl */ public function setActiveEditTtl($ttl = 180) { $this->ttl = \NumberUtils::bound($ttl, 10, 14400); }