EnvironmentConfigEvent::create()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

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