ConfigurationManager::setConfiguration()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
c 1
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
crap 1
1
<?php
2
3
namespace Flying\Struct;
4
5
/**
6
 * Structures configuration manager.
7
 *
8
 * The only purpose of this class is to define a point
9
 * where newly created structure classes will be able to take
10
 * information about structures configuration
11
 */
12
class ConfigurationManager
13
{
14
    /**
15
     * Structures configuration
16
     *
17
     * @var Configuration
18
     */
19
    private static $configuration;
20
21
    /**
22
     * Get structures configuration class
23
     *
24
     * @return Configuration
25
     */
26 196
    public static function getConfiguration()
27
    {
28 196
        if (!self::$configuration instanceof Configuration) {
29
            self::setConfiguration(new Configuration());
30
        }
31 196
        return self::$configuration;
32
    }
33
34
    /**
35
     * Set structures configuration class
36
     *
37
     * @param Configuration $configuration
38
     * @return void
39
     */
40 211
    public static function setConfiguration(Configuration $configuration)
41
    {
42 211
        self::$configuration = $configuration;
43 211
    }
44
}
45