SchulzeMargin::schulzeVariant()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 2
dl 0
loc 3
rs 10
c 0
b 0
f 0
ccs 2
cts 2
cp 1
crap 1
1
<?php
2
/*
3
    Part of SCHULZE 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\Schulze;
14
15
use CondorcetPHP\Condorcet\Algo\Methods\Schulze\Schulze_Core;
16
17
class SchulzeMargin extends Schulze_Core
18
{
19
    // Method Name
20
    public const METHOD_NAME = ['Schulze Margin','SchulzeMargin','Schulze_Margin'];
21
22 2
    protected function schulzeVariant (int &$i, int &$j) : int {
23 2
        return $this->_selfElection->getPairwise()[$i]['win'][$j] - $this->_selfElection->getPairwise()[$j]['win'][$i];
24
    }
25
}
26