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

ConfigProxy::getIterator()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
cc 2
eloc 2
nc 2
nop 0
dl 0
loc 4
ccs 0
cts 4
cp 0
crap 6
rs 10
c 0
b 0
f 0
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
}