Total Complexity | 9 |
Total Lines | 68 |
Duplicated Lines | 0 % |
Coverage | 40.63% |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
13 | class EmailsSend |
||
14 | { |
||
15 | /** |
||
16 | * @return int |
||
17 | */ |
||
18 | 1 | public function handle() |
|
19 | { |
||
20 | 1 | $sent = 0; |
|
21 | 1 | $batchCount = 1; |
|
22 | 1 | while ($sent < 10) { |
|
23 | 1 | $sentEmails = $this->sendBatch($batchCount); |
|
24 | 1 | if ($sentEmails === false) { |
|
25 | 1 | return $sent; |
|
26 | } |
||
27 | 1 | $sent += $this->sendBatch($batchCount); |
|
28 | 1 | $batchCount++; |
|
29 | } |
||
30 | return $sent; |
||
31 | } |
||
32 | |||
33 | /** |
||
34 | * @param int $number |
||
35 | * @return int |
||
36 | */ |
||
37 | 1 | protected function sendBatch($number = 1) |
|
42 | } |
||
43 | |||
44 | /** |
||
45 | * @param $emails |
||
46 | * @return int|bool |
||
47 | */ |
||
48 | protected function sendEmails($emails) |
||
67 | } |
||
68 | |||
69 | /** |
||
70 | * @param int $count |
||
71 | * @param int $offset |
||
72 | * @return RecordCollection |
||
73 | */ |
||
74 | protected function getEmailsBatch($count = 10, $offset = 0) |
||
85 |
If the returned type also contains false, it is an indicator that maybe an error condition leading to the specific return statement remains unhandled.