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

DowdallSystem   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 10
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

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

1 Method

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