/**
  * 
  */
 public function testIsOneOf()
 {
     $oneof = '<>\'"&';
     $input = '&';
     $this->assertTrue(Inspekt::isOneOf($input, $oneof));
 }
Exemple #2
0
 /**
  * Returns value if it is one of $allowed, FALSE otherwise.
  *
  * @param mixed $key
  * @return mixed
  *
  * @tag validator
  */
 function testOneOf($key, $allowed = NULL)
 {
     if (!$this->keyExists($key)) {
         return false;
     }
     if (Inspekt::isOneOf($this->_getValue($key), $allowed)) {
         return $this->_getValue($key);
     }
     return FALSE;
 }
Exemple #3
0
 /**
  * Returns value if it is one of $allowed, FALSE otherwise.
  *
  * @param mixed $key
  * @param null $allowed
  * @return mixed
  * @throws Exception
  * @tag validator
  */
 public function testOneOf($key, $allowed = null)
 {
     $value = $this->getValueOrNull($key);
     if (!is_null($value) && Inspekt::isOneOf($value, $allowed)) {
         return $value;
     }
     return false;
 }