1 | <?php |
||
16 | final class QueueProcessor |
||
17 | { |
||
18 | |||
19 | /** |
||
20 | * @var TransportInterface |
||
21 | */ |
||
22 | private $transport; |
||
23 | /** |
||
24 | * @var array|QueueInterface[] |
||
25 | */ |
||
26 | private $queue; |
||
27 | |||
28 | /** |
||
29 | * @param TransportInterface $transport |
||
30 | * @param QueueInterface[] $queue |
||
31 | */ |
||
32 | 7 | public function __construct(TransportInterface $transport, iterable $queue) |
|
37 | |||
38 | /** |
||
39 | * @param int|null $messageLimit |
||
40 | * @param int|null $timeLimit |
||
41 | * @return int |
||
42 | * @throws \Genkgo\Mail\Exception\QueueStoreException |
||
43 | */ |
||
44 | 7 | public function process(?int $messageLimit = null, ?int $timeLimit = null): int |
|
74 | |||
75 | /** |
||
76 | * @param MessageInterface $message |
||
77 | * @param int $timeLimit |
||
78 | * @return bool |
||
79 | */ |
||
80 | 7 | private function hasMessageExpired(MessageInterface $message, int $timeLimit): bool |
|
91 | |||
92 | /** |
||
93 | * @param MessageInterface $message |
||
94 | * @return int |
||
95 | */ |
||
96 | 1 | private function getSubmissionTimestamp(MessageInterface $message): int |
|
102 | } |
||
103 |
In PHP, under loose comparison (like
==
, or!=
, orswitch
conditions), values of different types might be equal.For
integer
values, zero is a special case, in particular the following results might be unexpected: