public function __construct($level, $max = 5) { $this->max = (int) $max; $level = (int) $level; if ($level < 1 || $level > $this->max) { throw new \OutOfRangeException(sprintf('given level %s is invalid', $level)); } $this->level = $level; }