Completed
Push — master ( 7e0874...14a89c )
by Vladimir
04:01 queued 01:49
created

Service   A

Complexity

Total Complexity 9

Size/Duplication

Total Lines 46
Duplicated Lines 0 %

Coupling/Cohesion

Components 3
Dependencies 0

Test Coverage

Coverage 90%

Importance

Changes 0
Metric Value
wmc 9
lcom 3
cbo 0
dl 0
loc 46
ccs 18
cts 20
cp 0.9
rs 10
c 0
b 0
f 0

7 Methods

Rating   Name   Duplication   Size   Complexity  
A getOption() 0 4 2
A hasRunTimeFlag() 0 4 1
A setRuntimeFlag() 0 4 1
A resetRuntimeFlags() 0 4 1
A getWorkingDirectory() 0 9 2
A setWorkingDirectory() 0 4 1
A setOption() 0 4 1
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 318
    public static function setRuntimeFlag($status)
32
    {
33 318
        self::$runTimeStatus |= $status;
34 318
    }
35
36 318
    public static function resetRuntimeFlags()
37
    {
38 318
        self::$runTimeStatus = 0;
39 318
    }
40
41 172
    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...
42
    {
43 172
        if (!self::$workingDirectory)
44
        {
45 139
            return getcwd();
46
        }
47
48 33
        return self::$workingDirectory;
49
    }
50
51 318
    public static function setWorkingDirectory($directory)
52
    {
53 318
        self::$workingDirectory = $directory;
54 318
    }
55
}
56