Completed
Push — master ( 922505...49fe4c )
by Boudry
05:20
created

CondorcetVersion::getObjectVersion()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 11
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 11
ccs 6
cts 6
cp 1
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 8
nc 2
nop 1
crap 2
1
<?php
2
/*
3
    Condorcet PHP Class, with Schulze Methods and others !
4
5
    By Julien Boudry - MIT LICENSE (Please read LICENSE.txt)
6
    https://github.com/julien-boudry/Condorcet
7
*/
8
declare(strict_types=1);
9
10
namespace Condorcet;
11
12
use Condorcet\Condorcet;
13
14
// Generic for many Condorcet Class
15
trait CondorcetVersion
16
{
17
    // Build by Version
18
    protected $_objectVersion = Condorcet::VERSION;
19
20 59
    public function getObjectVersion (string $options = null) : string
21
    {
22 59
        switch ($options) :
23 59
            case 'MAJOR':
24 1
                $version = explode('.', $this->_objectVersion);
25 1
                return $version[0].'.'.$version[1];
26
27
            default:
28 59
                return $this->_objectVersion;
29
        endswitch;
30
    }
31
}
32