CondorcetVersion   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A getObjectVersion() 0 9 2
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;
12
13
// Generic for many Condorcet Class
14
trait CondorcetVersion
15
{
16
    // Build by Version
17
    protected $_objectVersion = Condorcet::VERSION;
18
19 88
    public function getObjectVersion (bool $major = false) : string
20
    {
21 88
        if ($major === true) :
22 3
            $version = explode('.', $this->_objectVersion);
23 3
            return $version[0].'.'.$version[1];
24
        else :
25 88
            return $this->_objectVersion;
26
        endif;
27
    }
28
}
29