ConstructEvent::getTwig()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

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