Completed
Push — develop ( 2d4f17...d5975b )
by Nate
05:25
created

HubSpot   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 49
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 2
dl 0
loc 49
ccs 0
cts 21
cp 0
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A init() 0 10 1
A getSettings() 0 4 1
A getCache() 0 6 1
A getConnections() 0 6 1
1
<?php
2
3
/**
4
 * @copyright  Copyright (c) Flipbox Digital Limited
5
 * @license    https://flipboxfactory.com/software/hubspot/license
6
 * @link       https://www.flipboxfactory.com/software/hubspot/
7
 */
8
9
namespace flipbox\craft\hubspot\web\twig\variables;
10
11
use flipbox\craft\hubspot\HubSpot as HubSpotPlugin;
12
use flipbox\craft\hubspot\models\Settings;
13
use flipbox\craft\hubspot\services\Cache;
14
use flipbox\craft\hubspot\services\Connections;
15
use yii\di\ServiceLocator;
16
17
/**
18
 * @author Flipbox Factory <[email protected]>
19
 * @since 1.0.0
20
 */
21
class HubSpot extends ServiceLocator
22
{
23
    /**
24
     * @inheritdoc
25
     */
26
    public function init()
27
    {
28
        parent::init();
29
30
        $this->setComponents([
31
            'cache' => HubSpotPlugin::getInstance()->getCache(),
32
            'connections' => HubSpotPlugin::getInstance()->getConnections(),
33
            'criteria' => Criteria::class
34
        ]);
35
    }
36
37
38
    /**
39
     * Sub-Variables that are accessed 'craft.hubspot.settings'
40
     *
41
     * @return Settings
42
     */
43
    public function getSettings()
44
    {
45
        return HubSpotPlugin::getInstance()->getSettings();
46
    }
47
48
    /**
49
     * @noinspection PhpDocMissingThrowsInspection
50
     * @return Cache
51
     */
52
    public function getCache(): Cache
53
    {
54
        /** @noinspection PhpUnhandledExceptionInspection */
55
        /** @noinspection PhpIncompatibleReturnTypeInspection */
56
        return $this->get('cache');
57
    }
58
59
    /**
60
     * @noinspection PhpDocMissingThrowsInspection
61
     * @return Connections
62
     */
63
    public function getConnections(): Connections
64
    {
65
        /** @noinspection PhpUnhandledExceptionInspection */
66
        /** @noinspection PhpIncompatibleReturnTypeInspection */
67
        return $this->get('connections');
68
    }
69
}
70