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

ConstructEvent::create()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1.0156

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 7
ccs 3
cts 4
cp 0.75
rs 9.4285
cc 1
eloc 4
nc 1
nop 2
crap 1.0156
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
use WyriHaximus\TwigView\View\TwigView;
15
16
class ConstructEvent extends Event
17
{
18
    const EVENT = 'TwigView.TwigView.construct';
19
20
    /**
21
     * @param TwigView $twigView
22
     * @param \Twig_Environment $twig
23
     * @return static
24
     */
25 14
    public static function create(TwigView $twigView, \Twig_Environment $twig)
26
    {
27 14
        return new static(static::EVENT, $twigView, [
28
            'twigView' => $twigView,
29
            'twig' => $twig,
30
        ]);
31 14
    }
32
33
    /**
34
     * @return TwigView
35
     */
36
    public function getTwigView()
37
    {
38
        return $this->data()['twigView'];
39
    }
40
41
    /**
42
     * @return \Twig_Environment
43
     */
44
    public function getTwig()
45
    {
46
        return $this->data()['twig'];
47
    }
48
}
49