EnvironmentConfigEvent   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 1
dl 0
loc 42
ccs 9
cts 9
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A create() 0 7 1
A getConfig() 0 4 1
A setConfig() 0 6 1
1
<?php
2
declare(strict_types=1);
3
4
/**
5
 * This file is part of TwigView.
6
 *
7
 ** (c) 2015 Cees-Jan Kiewiet
8
 *
9
 * For the full copyright and license information, please view the LICENSE
10
 * file that was distributed with this source code.
11
 */
12
13
namespace WyriHaximus\TwigView\Event;
14
15
use Cake\Event\Event;
16
17
final class EnvironmentConfigEvent extends Event
18
{
19
    public const EVENT = 'TwigView.TwigView.environment';
20
21
    /**
22
     * @var array
23
     */
24
    private $config = [];
25
26
    /**
27
     * @param array $config
28
     *
29
     * @return static
30
     */
31 19
    public static function create(array $config): EnvironmentConfigEvent
32
    {
33 19
        $event = new static(static::EVENT);
34 19
        $event->setConfig($config);
35
36 19
        return $event;
37
    }
38
39
    /**
40
     * @return array
41
     */
42 19
    public function getConfig(): array
43
    {
44 19
        return $this->config;
45
    }
46
47
    /**
48
     * @param array $config
49
     *
50
     * @return $this
51
     */
52 19
    public function setConfig(array $config)
53
    {
54 19
        $this->config = array_replace_recursive($this->config, $config);
55
56 19
        return $this;
57
    }
58
}
59