Environment::getToolVersion()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 7
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 0
crap 2
1
<?php
2
/******************************************************************************
3
 * Wikipedia Account Creation Assistance tool                                 *
4
 * ACC Development Team. Please see team.json for a list of contributors.     *
5
 *                                                                            *
6
 * This is free and unencumbered software released into the public domain.    *
7
 * Please see LICENSE.md for the full licencing statement.                    *
8
 ******************************************************************************/
9
10
namespace Waca;
11
12
/**
13
 * Class providing information about the tool's runtime environment
14
 */
15
class Environment
16
{
17
    /**
18
     * @var string Cached copy of the tool version
19
     */
20
    private static $toolVersion = null;
21
22
    /**
23
     * Gets the tool version, using cached data if available.
24
     * @return string
25 1
     */
26
    public static function getToolVersion()
27 1
    {
28 1
        if (self::$toolVersion === null) {
0 ignored issues
show
introduced by
The condition self::toolVersion === null is always false.
Loading history...
29
            self::$toolVersion = exec("git describe --always --dirty");
30
        }
31 1
32
        return self::$toolVersion;
33
    }
34
}
35