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
|
|
|
|