Passed
Push — master ( cdf890...3fa5d8 )
by Vsevolods
03:14
created

ConfigProxy   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 59
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 45.83%

Importance

Changes 0
Metric Value
dl 0
loc 59
ccs 11
cts 24
cp 0.4583
rs 10
c 0
b 0
f 0
wmc 7
lcom 0
cbo 1

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A all() 0 4 1
A get() 0 4 1
A getIterator() 0 4 2
A has() 0 4 1
A jsonSerialize() 0 4 1
1
<?php declare(strict_types = 1);
2
3
namespace Venta\Config;
4
5
use IteratorAggregate;
6
use Venta\Contracts\Config\Config as ConfigContract;
7
use Venta\Contracts\Config\MutableConfig as MutableConfigContract;
8
9
/**
10
 * Class ConfigProxy
11
 *
12
 * @package Venta\Config
13
 */
14
class ConfigProxy implements IteratorAggregate, ConfigContract
15
{
16
17
    /**
18
     * @var MutableConfigContract
19
     */
20
    private $config;
21
22
    /**
23
     * ConfigProxy constructor.
24
     *
25
     * @param MutableConfigContract $config
26
     */
27 5
    public function __construct(MutableConfigContract $config)
28
    {
29 5
        $this->config = $config;
30 5
    }
31
32
    /**
33
     * @inheritDoc
34
     */
35 1
    public function all(): array
36
    {
37 1
        return $this->config->all();
38
    }
39
40
    /**
41
     * @inheritDoc
42
     */
43 1
    public function get(string $key, $default = null)
44
    {
45 1
        return $this->config->get($key, $default);
46
    }
47
48
    /**
49
     * @inheritDoc
50
     */
51
    public function getIterator()
52
    {
53
        return $this->config instanceof IteratorAggregate ? $this->config->getIterator() : $this->config;
54
    }
55
56
    /**
57
     * @inheritDoc
58
     */
59 1
    public function has(string $key): bool
60
    {
61 1
        return $this->config->has($key);
62
    }
63
64
    /**
65
     * @inheritDoc
66
     */
67 1
    function jsonSerialize()
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
68
    {
69 1
        return $this->config->jsonSerialize();
70
    }
71
72
}