/** * Set option boolean value * * @param boolean $value * @throws \InvalidArgumentException */ public function setValue($value) { if (!is_bool($value)) { throw new InvalidArgumentException('Boolean required'); } parent::setValue($value); }
/** * Set option integer value. * * @param int $value * * @throws \InvalidArgumentException */ public function setValue($value) { if (!is_integer($value)) { throw new InvalidArgumentException('Integer required'); } if ($this->minRange > $value || $this->maxRange < $value) { throw new InvalidArgumentException('Invalid Value'); } parent::setValue($value); }
/** * Set option string value. * * @param string $value * * @throws \InvalidArgumentException */ public function setValue($value) { if (!is_string($value)) { throw new InvalidArgumentException('String required'); } if ($this->minRange > strlen($value) || $this->maxRange < strlen($value)) { throw new InvalidArgumentException('Invalid Value'); } parent::setValue($value); }