Api\EnumType\ApiWebSearchOption::valueIsValid PHP Method

valueIsValid() public static method

Return true if value is allowed
public static valueIsValid ( mixed $value ) : boolean
$value mixed value
return boolean true|false
    public static function valueIsValid($value)
    {
        return $value === null || in_array($value, self::getValidValues(), true);
    }

Usage Example

 /**
  * Add element to array
  * @see AbstractStructArrayBase::add()
  * @throws \InvalidArgumentException
  * @uses \Api\EnumType\ApiWebSearchOption::valueIsValid()
  * @param string $item
  * @return \Api\ArrayType\ApiArrayOfWebSearchOption
  */
 public function add($item)
 {
     if (!\Api\EnumType\ApiWebSearchOption::valueIsValid($item)) {
         throw new \InvalidArgumentException(sprintf('Value "%s" is invalid, please use one of: %s', $item, implode(', ', \Api\EnumType\ApiWebSearchOption::getValidValues())), __LINE__);
     }
     return parent::add($item);
 }