*/ class RequiredValidator implements Validator { /** * Returns a boolean `true` when given `$value` is present * and not empty. Returns `false` otherwise. * * @param string $value * @param mixed $modifier * @return boolean */ public static function validate(string $value, mixed $modifier = null): bool { return isset($value) && $value !== ''; } /** * Composes the error message in case the validation fails. * * @param string $field * @param mixed $modifier * @return string */ public static function composeError(string $field, mixed $modifier = null): string { return "${field} is required."; } }