Conditions | 3 |
Paths | 3 |
Total Lines | 15 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Tests | 9 |
CRAP Score | 3 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
10 | 3 | public function canSendToEmail(string $email): bool |
|
11 | { |
||
12 | /** @var WrongEmail[]|Collection $emails */ |
||
13 | 3 | $emails = WrongEmail::active() |
|
14 | 3 | ->bounced() |
|
15 | 3 | ->where('email', '=', $email) |
|
16 | 3 | ->get(); |
|
17 | |||
18 | 3 | foreach ($emails as $wrongEmail) { |
|
19 | 2 | if (! $wrongEmail->canBouncedSend()) { |
|
20 | 2 | return false; |
|
21 | } |
||
22 | } |
||
23 | |||
24 | 2 | return true; |
|
25 | } |
||
44 |
This check looks for assignments to scalar types that may be of the wrong type.
To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.