-
Notifications
You must be signed in to change notification settings - Fork 570
Expand file tree
/
Copy pathbug-13669.php
More file actions
50 lines (38 loc) · 956 Bytes
/
bug-13669.php
File metadata and controls
50 lines (38 loc) · 956 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?php declare(strict_types = 1);
namespace Bug13669;
final class Foo
{
/**
* @var array<int, array<MailStatus::CODE_*, int>>
*/
private array $mailCounts;
/** @var array<int, array<MailStatus::CODE_*>> */
private array $sources;
/** @param array<int, array<MailStatus::CODE_*>> $sources */
private function __construct(array $sources)
{
$this->mailCounts = [];
$this->sources = $sources;
}
public function countMailStates(): void
{
foreach ($this->sources as $templateId => $mails) {
$this->mailCounts[$templateId] = [
MailStatus::CODE_DELETED => 0,
MailStatus::CODE_NOT_ACTIVE => 0,
MailStatus::CODE_ACTIVE => 0,
MailStatus::CODE_SIMULATION => 0,
];
foreach ($mails as $mail) {
++$this->mailCounts[$templateId][$mail];
}
}
}
}
final class MailStatus
{
public const CODE_DELETED = -1;
public const CODE_NOT_ACTIVE = 0;
public const CODE_SIMULATION = 1;
public const CODE_ACTIVE = 2;
}