DowdallSystem   A
last analyzed

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
rs 10
c 0
b 0
f 0
ccs 2
cts 2
cp 1
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 CondorcetPHP\Condorcet\Algo\Methods\Borda;
14
15
use CondorcetPHP\Condorcet\Result;
16
use CondorcetPHP\Condorcet\Algo\{Method, MethodInterface};
17
use CondorcetPHP\Condorcet\Algo\Methods\Borda\BordaCount;
18
19
class DowdallSystem extends BordaCount
20
{
21
    // Method Name
22
    public const METHOD_NAME = ['DowdallSystem','Dowdall System','Nauru', 'Borda Nauru'];
23
24 2
    protected function getScoreByCandidateRanking (int $CandidatesRanked) : float
25
    {
26 2
        return (float) 1 / ($CandidatesRanked + 1);
27
    }
28
}
29