Completed
Pull Request — 4.x (#81)
by Cees-Jan
02:52
created

EnvironmentConfigEvent   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 88.89%

Importance

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

3 Methods

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