Roman::init()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 8
dl 0
loc 12
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
/**
3
 * Roman plugin for Craft CMS 3.x
4
 *
5
 * Convert an integer into roman numerals and vice versa.
6
 *
7
 * @link      dominion-designs.com
8
 * @copyright Copyright (c) 2019 Jalen Davenport
9
 */
10
11
namespace jalendport\roman;
12
13
use jalendport\roman\services\RomanService;
14
use jalendport\roman\variables\RomanVariable;
15
16
use craft\base\Plugin;
17
use craft\web\twig\variables\CraftVariable;
18
19
use yii\base\Event;
20
21
/**
22
 * Roman
23
 *
24
 * @author    Jalen Davenport
25
 * @package   Roman
26
 * @since     1.0.0
27
 *
28
 * @property  RomanService $romanService
29
 */
30
class Roman extends Plugin
31
{
32
    /**
33
     * @var Roman
34
     */
35
    public static $plugin;
36
    
37
	/**
38
	 * Init method
39
	 */
40
	public function init()
41
    {
42
        parent::init();
43
        self::$plugin = $this;
44
        
45
        Event::on(
46
            CraftVariable::class,
47
            CraftVariable::EVENT_INIT,
48
            function (Event $event) {
49
                /** @var CraftVariable $variable */
50
                $variable = $event->sender;
51
                $variable->set('roman', RomanVariable::class);
52
            }
53
        );
54
    }
55
56
}
57