Completed
Push — master ( 5840b0...fcc03f )
by Frederik
04:51
created

SpamDecideScore::isLikelySpam()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 2
eloc 2
nc 2
nop 1
crap 2
1
<?php
2
3
namespace Genkgo\Mail\Protocol\Smtp;
4
5
/**
6
 * Class SpamDecideScore
7
 * @package Genkgo\Mail\Protocol\Smtp
8
 */
9
final class SpamDecideScore
10
{
11
12
    /**
13
     * @var int
14
     */
15
    private $ham;
16
    /**
17
     * @var int
18
     */
19
    private $spam;
20
21
    /**
22
     * SpamDecideScore constructor.
23
     * @param int $ham
24
     * @param int $spam
25
     */
26 7
    public function __construct(int $ham, int $spam)
27
    {
28 7
        $this->ham = $ham;
29 7
        $this->spam = $spam;
30 7
    }
31
32
    /**
33
     * @param int $score
34
     * @return bool
35
     */
36 1
    public function isHam(int $score): bool
37
    {
38 1
        return $this->ham >= $score;
39
    }
40
41
    /**
42
     * @param int $score
43
     * @return bool
44
     */
45 5
    public function isSpam(int $score): bool
46
    {
47 5
        return $this->spam <= $score;
48
    }
49
50
    /**
51
     * @param int $score
52
     * @return bool
53
     */
54 4
    public function isLikelySpam(int $score): bool
55
    {
56 4
        return $this->ham < $score && $this->spam > $score;
57
    }
58
59
}