Completed
Branch master (fa2fc5)
by Boudry
05:50 queued 02:29
created

DowdallSystem::getScoreByCandidateRanking()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 4
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
/*
3
    Part of BORDA COUNT method Module - From the original Condorcet PHP
4
5
    Condorcet PHP - Election manager and results calculator.
6
    Designed for the Condorcet method. Integrating a large number of algorithms extending Condorcet. Expandable for all types of voting systems.
7
8
    By Julien Boudry and contributors - MIT LICENSE (Please read LICENSE.txt)
9
    https://github.com/julien-boudry/Condorcet
10
*/
11
declare(strict_types=1);
12
13
namespace Condorcet\Algo\Methods;
14
15
use Condorcet\Algo\Method;
16
use Condorcet\Algo\MethodInterface;
17
18
use Condorcet\Result;
19
20
class DowdallSystem extends BordaCount
21
{
22
    // Method Name
23
    public const METHOD_NAME = ['DowdallSystem','Dowdall System','Nauru', 'Borda Nauru'];
24
25 2
    protected function getScoreByCandidateRanking (int $CandidatesRanked) : float
26
    {
27 2
        return (float) 1 / ($CandidatesRanked + 1);
28
    }
29
}
30