public function validates_format_of($attrs)
{
$configuration = array_merge(self::$DEFAULT_VALIDATION_OPTIONS, array('message' => Errors::$DEFAULT_ERROR_MESSAGES['invalid'], 'on' => 'save', 'with' => null));
foreach ($attrs as $attr) {
$options = array_merge($configuration, $attr);
$attribute = $options[0];
$var = $this->model->{$attribute};
if (is_null($options['with']) || !is_string($options['with'])) {
throw new ValidationsArgumentError('A regular expression must be supplied as the [with] option of the configuration array.');
} else {
$expression = $options['with'];
}
if ($this->is_null_with_option($var, $options) || $this->is_blank_with_option($var, $options)) {
continue;
}
if (!@preg_match($expression, $var)) {
$this->record->add($attribute, $options['message']);
}
}
}