Completed
Push — master ( a35590...2bf349 )
by Anton
02:59
created

Result::isAccept()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace Covery\Client;
4
5
/**
6
 * Class Result
7
 *
8
 * Contains decision result data, received from Covery
9
 *
10
 * @package Covery\Client
11
 */
12
class Result
13
{
14
    /**
15
     * @var int
16
     */
17
    private $requestId;
18
    /**
19
     * @var int
20
     */
21
    private $score;
22
    /**
23
     * @var bool
24
     */
25
    private $accept;
26
    /**
27
     * @var bool
28
     */
29
    private $reject;
30
    /**
31
     * @var bool
32
     */
33
    private $manual;
34
35
    /**
36
     * Result constructor.
37
     *
38
     * @param int $requestId
39
     * @param int $score
40
     * @param bool $accept
41
     * @param bool $reject
42
     * @param bool $manual
43
     */
44
    public function __construct($requestId, $score, $accept, $reject, $manual)
45
    {
46
        if (!is_int($requestId)) {
47
            throw new \InvalidArgumentException('Request ID must be integer');
48
        }
49
        if (!is_int($score)) {
50
            throw new \InvalidArgumentException('Score must be integer');
51
        }
52
        if (!is_bool($accept)) {
53
            throw new \InvalidArgumentException('Accept flag must be boolean');
54
        }
55
        if (!is_bool($reject)) {
56
            throw new \InvalidArgumentException('Reject flag must be boolean');
57
        }
58
        if (!is_bool($manual)) {
59
            throw new \InvalidArgumentException('Manual flag must be boolean');
60
        }
61
62
        $this->requestId = $requestId;
63
        $this->score = $score;
64
        $this->accept = $accept;
65
        $this->reject = $reject;
66
        $this->manual = $manual;
67
    }
68
69
    /**
70
     * @return int
71
     */
72
    public function getRequestId()
73
    {
74
        return $this->requestId;
75
    }
76
77
    /**
78
     * @return int
79
     */
80
    public function getScore()
81
    {
82
        return $this->score;
83
    }
84
85
    /**
86
     * @return boolean
87
     */
88
    public function isAccept()
89
    {
90
        return $this->accept;
91
    }
92
93
    /**
94
     * @return boolean
95
     */
96
    public function isReject()
97
    {
98
        return $this->reject;
99
    }
100
101
    /**
102
     * @return boolean
103
     */
104
    public function isManual()
105
    {
106
        return $this->manual;
107
    }
108
}
109