Passed
Push — nested-sections ( 2d40b2...7dbf34 )
by Arnaud
12:03 queued 05:37
created

Config   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 67
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 13
dl 0
loc 67
rs 10
c 1
b 0
f 0
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A offsetSet() 0 3 1
A offsetGet() 0 4 1
A offsetExists() 0 4 1
A offsetUnset() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of Cecil.
7
 *
8
 * Copyright (c) Arnaud Ligny <[email protected]>
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code.
12
 */
13
14
namespace Cecil\Renderer;
15
16
use Cecil\Builder;
17
18
/**
19
 * Class Config.
20
 */
21
class Config implements \ArrayAccess
22
{
23
    /** @var Builder Builder object. */
24
    protected $builder;
25
26
    /** @var \Cecil\Config */
27
    protected $config;
28
29
    /** @var string Current language. */
30
    protected $language;
31
32
    public function __construct(Builder $builder, string $language)
33
    {
34
        $this->builder = $builder;
35
        $this->config = $this->builder->getConfig();
36
        $this->language = $language;
37
    }
38
39
    /**
40
     * Implement ArrayAccess.
41
     *
42
     * @param mixed $offset
43
     *
44
     * @return bool
45
     */
46
    #[\ReturnTypeWillChange]
47
    public function offsetExists($offset): bool
48
    {
49
        return $this->config->has($offset);
50
    }
51
52
    /**
53
     * Implements \ArrayAccess.
54
     *
55
     * @param mixed $offset
56
     *
57
     * @return mixed|null
58
     */
59
    #[\ReturnTypeWillChange]
60
    public function offsetGet($offset)
61
    {
62
        return $this->config->get($offset, $this->language);
63
    }
64
65
    /**
66
     * Implements \ArrayAccess.
67
     *
68
     * @param mixed $offset
69
     * @param mixed $value
70
     *
71
     * @SuppressWarnings(PHPMD.UnusedFormalParameter)
72
     */
73
    #[\ReturnTypeWillChange]
74
    public function offsetSet($offset, $value): void
75
    {
76
    }
77
78
    /**
79
     * Implements \ArrayAccess.
80
     *
81
     * @param mixed $offset
82
     *
83
     * @SuppressWarnings(PHPMD.UnusedFormalParameter)
84
     */
85
    #[\ReturnTypeWillChange]
86
    public function offsetUnset($offset): void
87
    {
88
    }
89
}
90