Link   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 3
dl 0
loc 32
c 0
b 0
f 0
ccs 0
cts 15
cp 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A init() 0 14 1
A getType() 0 4 1
1
<?php
2
3
/**
4
 * @copyright  Copyright (c) Flipbox Digital Limited
5
 * @license    https://flipboxfactory.com/software/link/license
6
 * @link       https://www.flipboxfactory.com/software/link/
7
 */
8
9
namespace flipbox\link;
10
11
use craft\base\Plugin;
12
use craft\events\RegisterComponentTypesEvent;
13
use craft\services\Fields;
14
use flipbox\link\fields\Link as LinkField;
15
use yii\base\Event;
16
17
/**
18
 * @author Flipbox Factory <[email protected]>
19
 * @since 1.0.0
20
 */
21
class Link extends Plugin
22
{
23
    /**
24
     * @inheritdoc
25
     */
26
    public function init()
27
    {
28
        // Do parent
29
        parent::init();
30
31
        // Register our fields
32
        Event::on(
33
            Fields::class,
34
            Fields::EVENT_REGISTER_FIELD_TYPES,
35
            function (RegisterComponentTypesEvent $event) {
36
                $event->types[] = LinkField::class;
37
            }
38
        );
39
    }
40
41
    /*******************************************
42
     * SERVICES
43
     *******************************************/
44
45
    /**
46
     * @return services\Type
47
     */
48
    public function getType()
49
    {
50
        return $this->get('type');
51
    }
52
}
53