feat(classifier): has_valid_email_anywhere() helper for drop-logic
This commit is contained in:
@@ -215,4 +215,19 @@ final class Classifier
|
||||
}
|
||||
return $hits;
|
||||
}
|
||||
|
||||
public static function has_valid_email_anywhere(array $fields): bool
|
||||
{
|
||||
foreach ($fields as $v) {
|
||||
$values = is_array($v) ? $v : [$v];
|
||||
foreach ($values as $val) {
|
||||
$val = trim((string)$val);
|
||||
if ($val === '') continue;
|
||||
if (preg_match('/[A-Za-z0-9._%+\-]+@[A-Za-z0-9.\-]+\.[A-Za-z]{2,}/', $val, $m)) {
|
||||
if (is_email($m[0])) return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user