AggregateSpamScore   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 0
dl 0
loc 30
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A calculate() 0 10 2
1
<?php
2
declare(strict_types=1);
3
4
namespace Genkgo\Mail\Protocol\Smtp\SpamScore;
5
6
use Genkgo\Mail\MessageInterface;
7
use Genkgo\Mail\Protocol\Smtp\SpamScoreInterface;
8
9
final class AggregateSpamScore implements SpamScoreInterface
10
{
11
    /**
12
     * @var array|SpamScoreInterface[]
13
     */
14
    private $checkers;
15
16
    /**
17
     * @param array|SpamScoreInterface[] $checkers
18
     */
19 1
    public function __construct(array $checkers)
20
    {
21 1
        $this->checkers = $checkers;
22 1
    }
23
24
    /**
25
     * @param MessageInterface $message
26
     * @return int
27
     */
28 1
    public function calculate(MessageInterface $message): int
29
    {
30 1
        $score = 0;
31
32 1
        foreach ($this->checkers as $check) {
33 1
            $score += $check->calculate($message);
34
        }
35
36 1
        return $score;
37
    }
38
}
39