Skip to content

Commit 169fb21

Browse files
update
1 parent 48cc38a commit 169fb21

File tree

2 files changed

+97
-8
lines changed

2 files changed

+97
-8
lines changed

src/TameHelper.php

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,27 +15,31 @@ class TameHelper
1515
* so for large batches, consider running in background or using emailPing() for speed.
1616
*
1717
* @param array $emails Array of email addresses to verify
18-
* @return array Associative array of email [sorted|unsorted]
18+
* @return array Associative array of email [verified|unverified|runtime]
1919
*/
2020
public static function batchDeepEmailPing(array $emails)
2121
{
22-
$good = 'verified';
23-
$wrong = 'unverified';
22+
$correct = 'verified';
23+
$incorrect = 'unverified';
24+
$start = microtime(true);
2425

2526
$results = [
26-
$good => [],
27-
$wrong => []
27+
$correct => [],
28+
$incorrect => []
2829
];
2930

3031
foreach ($emails as $email) {
3132
$valid = self::deepEmailPing($email);
3233
if ($valid) {
33-
$results[$good][] = $email;
34+
$results[$correct][] = $email;
3435
} else {
35-
$results[$wrong][] = $email;
36+
$results[$incorrect][] = $email;
3637
}
3738
}
38-
39+
40+
$results['total_emails'] = count($emails);
41+
$results['runtime'] = microtime(true) - $start;
42+
3943
return $results;
4044
}
4145

tests/tame.php

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
// $emailChecker = Tame()->emailValidator('[email protected]');
2828

2929
$emails = [
30+
// your original list (12)
3031
3132
3233
@@ -40,6 +41,7 @@
4041
4142
4243

44+
// common providers / likely resolvable (10)
4345
4446
4547
@@ -51,6 +53,7 @@
5153
5254
5355

56+
// bogus / non-resolving examples (20)
5457
5558
5659
@@ -61,6 +64,88 @@
6164
6265
6366
67+
68+
// mixed additional real / well-known (12)
69+
70+
71+
72+
73+
74+
75+
76+
77+
78+
79+
80+
'bounce@localhost',
81+
82+
// more test / reserved / local (10)
83+
84+
'test@localhost',
85+
86+
87+
88+
89+
90+
91+
92+
93+
94+
// enterprise / intranet style (10)
95+
96+
97+
98+
99+
100+
101+
102+
103+
104+
105+
106+
// business / startup style (12)
107+
108+
109+
110+
111+
112+
113+
114+
115+
116+
117+
118+
119+
120+
// probing / scanning style (14)
121+
122+
123+
124+
125+
126+
127+
128+
129+
130+
131+
132+
133+
134+
135+
136+
// monitoring / ops / edge cases (12)
137+
138+
139+
140+
141+
142+
143+
144+
145+
146+
147+
148+
64149
];
65150

66151

0 commit comments

Comments
 (0)