Example #1
0
 public function validate(array $data)
 {
     parent::validate($data);
     foreach ($data as $value) {
         if (!is_numeric($value)) {
             throw new \InvalidArgumentException('Cannot add non-numeric value to NumberSet');
         }
     }
 }
Example #2
0
 /**
  * @inheritDoc
  *
  * @throws ConfigurationException If any class is not of the expected type
  */
 public function validate(array $classes)
 {
     parent::validate($classes);
     foreach ($classes as $class) {
         if (!is_subclass_of($class, ConfigurationInterface::class)) {
             throw ConfigurationException::invalidClass($class);
         }
     }
 }
Example #3
0
 /**
  * @param array $middlewares
  * @throws \DomainException if $middlewares does not conform to type expectations
  */
 public function validate(array $middlewares)
 {
     parent::validate($middlewares);
     foreach ($middlewares as $middleware) {
         if (!(is_callable($middleware) || method_exists($middleware, '__invoke'))) {
             throw new \DomainException('All elements of $middlewares must be callable');
         }
     }
 }
 /**
  * @inheritDoc
  */
 public function validate(array $data)
 {
     parent::validate($data);
     foreach ($data as $responder) {
         if (!is_subclass_of($responder, ResponderInterface::class)) {
             throw new InvalidArgumentException(sprintf('All responders in `%s` must implement `%s`', static::class, ResponderInterface::class));
         }
     }
 }