Completed
Pull Request — master (#44)
by Cees-Jan
20:58 queued 19:07
created

EnvironmentConfigEvent   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 33.33%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 1
dl 0
loc 32
ccs 2
cts 6
cp 0.3333
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A create() 0 6 1
A getConfig() 0 4 1
A setConfig() 0 4 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 12
    public static function create(array $config)
25
    {
26
        return new static(static::EVENT, null, [
27
            'config' => $config,
28
        ]);
29 12
    }
30
31
    /**
32
     * @return array
33
     */
34
    public function getConfig()
35
    {
36
        return $this->data()['config'];
37
    }
38
39
    /**
40
     * @param array $config
41
     */
42
    public function setConfig(array $config)
43
    {
44
        $this->data['config'] = array_replace_recursive($this->data['config'], $config);
45
    }
46
}
47