Completed
Pull Request — master (#3)
by
unknown
02:03
created

ConstVoter   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 35
c 0
b 0
f 0
wmc 2
lcom 1
cbo 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A vote() 0 4 1
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