Completed
Pull Request — master (#4)
by Ondrej
01:56
created

ConstVoter::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
c 0
b 0
f 0
rs 9.4285
cc 1
eloc 3
nc 1
nop 2
1
<?php
2
3
namespace SpareParts\Overseer\Voter;
4
5
6
use SpareParts\Overseer\Context\IVotingContext;
7
use SpareParts\Overseer\VotingDecisionEnum;
8
9
class ConstVoter implements IVoter
10
{
11
    /**
12
     * @var VotingDecisionEnum
13
     */
14
    private $constDecision;
15
16
    /**
17
     * @var mixed
18
     */
19
    private $constReason;
20
21
22
    /**
23
     * ConstVoter constructor.
24
     * @param VotingDecisionEnum $constDecision
25
     * @param mixed $constReason
26
     */
27
    public function __construct(VotingDecisionEnum $constDecision, $constReason = null)
28
    {
29
        $this->constDecision = $constDecision;
30
        $this->constReason = $constReason;
31
    }
32
33
34
    /**
35
     * @param mixed $votingSubject
36
     * @param \SpareParts\Overseer\Context\IVotingContext $votingContext
37
     * @return ISingleVoterResult
38
     */
39
    public function vote($votingSubject, IVotingContext $votingContext)
40
    {
41
        return new SingleVoterResult($this->constDecision, $this->constReason);
42
    }
43
}
44