Пример #1
0
 /**
  * Checks if value is a Filter
  *
  * @param   mixed       $value          Value to evaluate
  * @param   array       $requirements   Array of constraints
  * @return  array       Cleared value
  * @throws  InvalidDataException        If the value is not a Filter or fails constraints checks
  */
 public static function checkFilters($value, array $requirements)
 {
     $filters = array();
     if (is_array($value)) {
         // Check if we are dealing with filters or one Filter
         if (is_array($value[0])) {
             foreach ($value as $filter) {
                 $filters[] = FilterType::check($filter, $requirements);
             }
         } else {
             $filters[] = FilterType::check($value, $requirements);
         }
     }
     return $filters;
 }
Пример #2
0
 /**
  * @expectedException Ucc\Exception\Data\InvalidDataValueException
  * @expectedExceptionMessage part 4 (type) must be one of (field or value)
  */
 public function testCheckFailWrongType()
 {
     $supplied = array('and-id-eq-wrongType-12');
     $requirements = array('fields' => array('id'));
     $actual = FilterType::check($supplied, $requirements);
 }