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

AwsSesBounceComplaintHandler   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 9
c 2
b 0
f 0
dl 0
loc 17
ccs 9
cts 9
cp 1
rs 10
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A canSendToEmail() 0 15 3
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