ConfigurationAccessor   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 55
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 55
rs 10
c 0
b 0
f 0
ccs 12
cts 12
cp 1
wmc 5
lcom 1
cbo 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getConfig() 0 4 1
A get() 0 4 1
A has() 0 4 1
A set() 0 5 1
A add() 0 5 1
1
<?php declare(strict_types=1);
2
/* (c) Anton Medvedev <[email protected]>
3
 *
4
 * For the full copyright and license information, please view the LICENSE
5
 * file that was distributed with this source code.
6
 */
7
8
namespace Deployer\Configuration;
9
10
trait ConfigurationAccessor
11
{
12
    /**
13
     * @var Configuration
14
     */
15
    private $config;
16
17 16
    public function getConfig(): Configuration
18
    {
19 16
        return $this->config;
20
    }
21
22
    /**
23
     * Get configuration options
24
     *
25
     * @param mixed $default
26
     * @return mixed
27
     */
28 25
    public function get(string $name, $default = null)
29
    {
30 25
        return $this->config->get($name, $default);
31
    }
32
33
    /**
34
     * Check configuration option
35
     */
36 24
    public function has(string $name): bool
37
    {
38 24
        return $this->config->has($name);
39
    }
40
41
    /**
42
     * Set configuration option
43
     *
44
     * @param mixed $value
45
     * @return static
46
     */
47 21
    public function set(string $name, $value)
48
    {
49 21
        $this->config->set($name, $value);
50 21
        return $this;
51
    }
52
53
    /**
54
     * Add configuration option
55
     *
56
     * @param mixed[] $value
57
     * @return static
58
     */
59 1
    public function add(string $name, array $value)
60
    {
61 1
        $this->config->add($name, $value);
62 1
        return $this;
63
    }
64
}
65