VirtualVote::removeCandidates()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 10

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2

Importance

Changes 0
Metric Value
cc 2
nc 2
nop 2
dl 0
loc 10
ccs 5
cts 5
cp 1
crap 2
rs 9.9332
c 0
b 0
f 0
1
<?php
2
/*
3
    Condorcet PHP - Election manager and results calculator.
4
    Designed for the Condorcet method. Integrating a large number of algorithms extending Condorcet. Expandable for all types of voting systems.
5
6
    By Julien Boudry and contributors - MIT LICENSE (Please read LICENSE.txt)
7
    https://github.com/julien-boudry/Condorcet
8
*/
9
declare(strict_types=1);
10
11
namespace CondorcetPHP\Condorcet\Algo\Tools;
12
13
use CondorcetPHP\Condorcet\Vote;
14
15
class VirtualVote
16
{
17 1
    public static function removeCandidates (Vote $vote, array $candidatesList) : Vote
18
    {
19 1
        $virtualVote = clone $vote;
20
21 1
        foreach ($candidatesList as $oneCandidate) :
22 1
            $virtualVote->removeCandidate($oneCandidate);
23
        endforeach;
24
25 1
        return $virtualVote;
26
    }
27
}
28