Passed
Push — master ( 754eba...577a19 )
by Vsevolods
03:09
created

ConfigProxy   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 67
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
dl 0
loc 67
ccs 0
cts 28
cp 0
rs 10
c 0
b 0
f 0
wmc 8
lcom 0
cbo 1

7 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A all() 0 4 1
A count() 0 4 1
A get() 0 4 1
A has() 0 4 1
A jsonSerialize() 0 4 1
A getIterator() 0 4 2
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
    public function __construct(MutableConfigContract $config)
28
    {
29
        $this->config = $config;
30
    }
31
32
    /**
33
     * @inheritDoc
34
     */
35
    public function all(): array
36
    {
37
        return $this->config->all();
38
    }
39
40
    /**
41
     * @inheritDoc
42
     */
43
    public function count()
44
    {
45
        return $this->config->count();
46
    }
47
48
    /**
49
     * @inheritDoc
50
     */
51
    public function get(string $key, $default = null)
52
    {
53
        return $this->config->get($key, $default);
54
    }
55
56
    /**
57
     * @inheritDoc
58
     */
59
    public function has(string $key): bool
60
    {
61
        return $this->config->has($key);
62
    }
63
64
    /**
65
     * @inheritDoc
66
     */
67
    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
        return $this->config->jsonSerialize();
70
    }
71
72
    /**
73
     * @inheritDoc
74
     */
75
    public function getIterator()
76
    {
77
        return $this->config instanceof IteratorAggregate ? $this->config->getIterator() : $this->config;
78
    }
79
80
}