Completed
Push — master ( 4ac545...fafd4b )
by Nate
03:35
created

Ember   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 0%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A init() 0 11 2
1
<?php
2
3
/**
4
 * @copyright  Copyright (c) Flipbox Digital Limited
5
 * @license    https://github.com/flipbox/ember/blob/master/LICENSE
6
 * @link       https://github.com/flipbox/ember
7
 */
8
9
namespace flipbox\ember;
10
11
use craft\events\RegisterTemplateRootsEvent;
12
use craft\web\View;
13
use yii\base\Event;
14
use yii\base\Module;
15
16
/**
17
 * @author Flipbox Factory <[email protected]>
18
 * @since 1.0.0
19
 */
20
class Ember extends Module
21
{
22
    /**
23
     * @inheritdoc
24
     */
25
    public function init()
26
    {
27
        parent::init();
28
29
        // Base template directory
30
        Event::on(View::class, View::EVENT_REGISTER_CP_TEMPLATE_ROOTS, function (RegisterTemplateRootsEvent $e) {
31
            if (is_dir($baseDir = $this->getBasePath() . DIRECTORY_SEPARATOR . 'templates')) {
32
                $e->roots[$this->uniqueId] = $baseDir;
33
            }
34
        });
35
    }
36
}
37