/** * Performs value validation. * * @param mixed $value Value. * * @return void * @throws \InvalidArgumentException When validation failed. */ protected function validate($value) { parent::validate($value); foreach ($value as $path) { if (!file_exists($path) || !is_dir($path)) { throw new \InvalidArgumentException('The "' . $path . '" path doesn\'t exist or not a directory.'); } } }
/** * Performs value validation. * * @param mixed $value Value. * * @return void * @throws \InvalidArgumentException When validation failed. */ protected function validate($value) { parent::validate($value); foreach ($value as $regexp) { if (@preg_match($regexp, 'test') === false) { throw new \InvalidArgumentException('The "' . $regexp . '" is not a valid regular expression.'); } } }