Trigger::init()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 10
ccs 0
cts 8
cp 0
rs 9.4285
cc 2
eloc 5
nc 2
nop 0
crap 6
1
<?php
2
3
namespace flipbox\twig;
4
5
use Craft;
6
use craft\base\Plugin;
7
8
class Trigger extends Plugin
9
{
10
    /**
11
     * @inheritdoc
12
     */
13
    public function init()
14
    {
15
        parent::init();
16
17
        // Add in our Twig extensions
18
        $twig = Craft::$app->getView()->getTwig();
19
        if (!$twig->hasExtension(TriggerExtension::class)) {
20
            $twig->addExtension(new TriggerExtension());
21
        }
22
    }
23
}
24