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'); } } }
/** * @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); } } }
/** * @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)); } } }