format = ! empty($format); return true; } /** * Enable format * @param bool $format * @return static */ public function format($format) { $this->setFormat($format); return $this; } public function check(&$value) { if ($this->format) { $value = bff::input()->formatEmail($value); } return filter_var($value, FILTER_VALIDATE_EMAIL) !== false; } /** * Default message * @return string */ public function defaultMessage(): string { return _t('error', 'The [attribute] is not valid email'); } }