CondorcetVersion::getObjectVersion()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2

Importance

Changes 0
Metric Value
cc 2
nc 2
nop 1
dl 0
loc 9
ccs 5
cts 5
cp 1
crap 2
rs 9.9666
c 0
b 0
f 0
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