public function __construct(array $config) { if (!isset($config['max']) || !is_int($config['max']) || $config['max'] < 1) { throw new Exception('MaxLength validators must be configured with a non-zero integer `max` value'); } parent::__construct($config); $this->max = $config['max']; }
public function __construct(array $config) { if (!isset($config['callback']) || !is_callable($config['callback'])) { throw new Exception('Callable validators must be configured with a valid callable'); } $this->callable = $config['callback']; parent::__construct($config); }
public function __construct(array $config) { if (empty($config['pattern'])) { $config['pattern'] = static::PATTERN; } if (empty($config['pattern']) || !is_string($config['pattern'])) { throw new Exception('Regex validators must be configured with a `pattern` string value'); } parent::__construct($config); $this->pattern = $config['pattern']; }