Completed
Pull Request — master (#91)
by Vladimir
02:23
created

Service::removeRuntimeFlag()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
c 0
b 0
f 0
ccs 0
cts 3
cp 0
rs 10
cc 1
nc 1
nop 1
crap 2
1
<?php
2
3
/**
4
 * @copyright 2018 Vladimir Jimenez
5
 * @license   https://github.com/stakx-io/stakx/blob/master/LICENSE.md MIT
6
 */
7
8
namespace allejo\stakx;
9
10
abstract class Service
11
{
12
    protected static $workingDirectory;
13
    protected static $runTimeStatus;
14
    protected static $options;
15
16 12
    public static function setOption($key, $value)
17
    {
18 12
        self::$options[$key] = $value;
19 12
    }
20
21
    public static function getOption($key)
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
22
    {
23
        return isset(self::$options[$key]) ? self::$options[$key] : null;
24
    }
25
26 94
    public static function hasRunTimeFlag($status)
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
27
    {
28 94
        return self::$runTimeStatus & $status;
29
    }
30
31 329
    public static function setRuntimeFlag($status)
32
    {
33 329
        self::$runTimeStatus |= $status;
34 329
    }
35
36
    public static function removeRuntimeFlag($status)
37
    {
38
        self::$runTimeStatus &= ~$status;
39
    }
40
41 329
    public static function resetRuntimeFlags()
42
    {
43 329
        self::$runTimeStatus = 0;
44 329
    }
45
46 183
    public static function getWorkingDirectory()
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
47
    {
48 183
        if (!self::$workingDirectory)
49
        {
50 150
            return getcwd();
51
        }
52
53 33
        return self::$workingDirectory;
54
    }
55
56 329
    public static function setWorkingDirectory($directory)
57
    {
58 329
        self::$workingDirectory = $directory;
59 329
    }
60
}
61