setValue() public method

Set option value.
public setValue ( mixed $value )
$value mixed
 /**
  * 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);
 }
Ejemplo n.º 2
0
 /**
  * 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);
 }
Ejemplo n.º 3
0
 /**
  * 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);
 }