예제 #1
0
 /**
  * {@inheritdoc}
  */
 public function isValid(&$value)
 {
     if (null !== $value) {
         return $this->validator->isValid($value);
     }
     return true;
 }
예제 #2
0
 /**
  * {@inheritdoc}
  */
 public function isValid(&$value)
 {
     if (!is_array($value)) {
         $givenType = "object" == gettype($value) ? get_class($value) : gettype($value);
         throw new ValueObjectException("Array expected, [{$givenType}] given");
     }
     foreach ($value as $k => &$v) {
         try {
             $this->elementValidator->isValid($v);
         } catch (ValueObjectException $e) {
             throw new ValueObjectException("Invalid array: key '{$k}': " . $e->getMessage(), $e->getCode(), $e);
         }
     }
     return true;
 }