Passed
Push — master ( 89f24e...8c4dad )
by Sylvain
08:05
created

NoMail::filter()   A

Complexity

Conditions 4
Paths 2

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 4

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 4
eloc 4
c 1
b 0
f 0
nc 2
nop 1
dl 0
loc 9
ccs 5
cts 5
cp 1
crap 4
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Ecodev\Felix\Log\Filter;
6
7
use GraphQL\Error\Error;
8
use Laminas\Log\Filter\FilterInterface;
9
10
final class NoMail implements FilterInterface
11
{
12
    /**
13
     * Ignore exception that are explicitly marked as ignored
14
     */
15 14
    public function filter(array $event): bool
16
    {
17 14
        $exception = $event['extra']['exception'] ?? null;
18
19 14
        if ($exception instanceof NoMailLogging || ($exception instanceof Error && $exception->getPrevious() instanceof NoMailLogging)) {
20 3
            return false;
21
        }
22
23 11
        return true;
24
    }
25
}
26