ElectionManager   A
last analyzed

Complexity

Total Complexity 8

Size/Duplication

Total Lines 49
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 22.22%

Importance

Changes 0
Metric Value
wmc 8
lcom 0
cbo 0
dl 0
loc 49
c 0
b 0
f 0
ccs 4
cts 18
cp 0.2222
rs 10

8 Methods

Rating   Name   Duplication   Size   Complexity  
A isElection() 0 4 1
A getEligibleVoters() 0 4 1
A calculateElectionResult() 0 4 1
A getElectionWinner() 0 4 1
A __construct() 0 4 1
A getElectionResults() 0 4 1
A submitVotes() 0 4 1
A getElectionPollVotes() 0 4 1
1
<?php
2
3
namespace AppBundle\Utils;
4
5
use AppBundle\Entity\{
6
	Choice, Poll
7
};
8
use Doctrine\Common\Persistence\ManagerRegistry;
9
10
class ElectionManager
11
{
12
	private $doctrineRegistry;
13
14
	/**
15
	 * Constructor.
16
	 *
17
	 * @param \Doctrine\Common\Persistence\ManagerRegistry $doctrineRegistry
18 1
	 */
19
	public function __construct(ManagerRegistry $doctrineRegistry)
20 1
    {
21 1
	    $this->doctrineRegistry = $doctrineRegistry;
22 1
    }
23
24
    public function isElection(Poll $poll): boolean
0 ignored issues
show
Unused Code introduced by
The parameter $poll is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
25
    {
26
        return false;
27
    }
28
29
    public function getEligibleVoters(): array
30
    {
31
        return [];
32
    }
33
34
    public function calculateElectionResult(Poll $poll): array
35
    {
36
	    return $this->getElectionResults($poll);
37
    }
38
39
	public function getElectionResults(Poll $poll): array
0 ignored issues
show
Unused Code introduced by
The parameter $poll is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
40
	{
41
		return [];
42
	}
43
44
    public function submitVotes(array $choices)
0 ignored issues
show
Unused Code introduced by
The parameter $choices is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
45
    {
46
        return;
47
    }
48
49
    public function getElectionPollVotes(Poll $poll): array
0 ignored issues
show
Unused Code introduced by
The parameter $poll is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
50
    {
51
        return [];
52
    }
53
54
	public function getElectionWinner(Poll $poll): Choice
0 ignored issues
show
Unused Code introduced by
The parameter $poll is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
55
    {
56
        return;
57
    }
58
}
59