ConstructEvent   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A create() 0 7 1
A getTwigView() 0 4 1
A getTwig() 0 4 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
use Twig\Environment;
17
use WyriHaximus\TwigView\View\TwigView;
18
19
final class ConstructEvent extends Event
20
{
21
    public const EVENT = 'TwigView.TwigView.construct';
22
23
    /**
24
     * @param  \WyriHaximus\TwigView\View\TwigView          $twigView
25
     * @param  \Twig\Environment $twig
26
     * @return static
27
     */
28 18
    public static function create(TwigView $twigView, Environment $twig): ConstructEvent
29
    {
30 18
        return new static(static::EVENT, $twigView, [
31 18
            'twigView' => $twigView,
32 18
            'twig' => $twig,
33
        ]);
34
    }
35
36
    /**
37
     * @return \WyriHaximus\TwigView\View\TwigView
38
     */
39 1
    public function getTwigView(): TwigView
40
    {
41 1
        return $this->getData()['twigView'];
42
    }
43
44
    /**
45
     * @return \Twig\Environment
46
     */
47 8
    public function getTwig(): Environment
48
    {
49 8
        return $this->getData()['twig'];
50
    }
51
}
52