Passed
Push — master ( b9e179...1762c3 )
by George
04:42
created

AwsSesBounceComplaintHandler::handleLoggingData()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2

Importance

Changes 0
Metric Value
cc 2
eloc 4
c 0
b 0
f 0
nc 2
nop 1
dl 0
loc 6
ccs 5
cts 5
cp 1
crap 2
rs 10
1
<?php
2
3
namespace ag84ark\AwsSesBounceComplaintHandler;
4
5
use ag84ark\AwsSesBounceComplaintHandler\Models\WrongEmail;
6
use Illuminate\Support\Collection;
7
8
class AwsSesBounceComplaintHandler
9
{
10 2
    public static function canSendToEmail(string $email): bool
11
    {
12
        /** @var WrongEmail[]|Collection $emails */
13 2
        $emails = WrongEmail::active()
14 2
            ->bounced()
15 2
            ->where('email', '=', $email)
16 2
            ->get();
17
18 2
        foreach ($emails as $wrongEmail) {
19 1
            if (! $wrongEmail->canBouncedSend()) {
20 1
                return false;
21
            }
22
        }
23
24 1
        return true;
25
    }
26
}
27