AbstractController   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 71
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 3
dl 0
loc 71
ccs 0
cts 28
cp 0
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getBaseActionPath() 0 4 1
A getBaseCpPath() 0 4 1
A getBaseContinueEditingUrl() 0 4 1
A baseVariables() 0 13 1
A insertVariables() 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\cp\controllers\settings\view;
10
11
use flipbox\craft\ember\helpers\UrlHelper;
12
use flipbox\craft\hubspot\cp\Cp as CpModule;
13
use flipbox\craft\hubspot\HubSpot;
14
15
/**
16
 * @author Flipbox Factory <[email protected]>
17
 * @since 1.0.0
18
 *
19
 * @property CpModule $module
20
 */
21
abstract class AbstractController extends \flipbox\craft\hubspot\cp\controllers\view\AbstractController
22
{
23
    /**
24
     * The index view template path
25
     */
26
    const TEMPLATE_BASE = parent::TEMPLATE_BASE . '/settings';
27
28
    /*******************************************
29
     * BASE PATHS
30
     *******************************************/
31
32
    /**
33
     * @return string
34
     */
35
    protected function getBaseActionPath(): string
36
    {
37
        return parent::getBaseActionPath() . '/settings';
38
    }
39
40
    /**
41
     * @return string
42
     */
43
    protected function getBaseCpPath(): string
44
    {
45
        return parent::getBaseCpPath() . '/settings';
46
    }
47
48
    /**
49
     * @param string $endpoint
50
     * @return string
51
     */
52
    protected function getBaseContinueEditingUrl(string $endpoint = ''): string
53
    {
54
        return $this->getBaseCpPath() . $endpoint;
55
    }
56
57
    /*******************************************
58
     * VARIABLES
59
     *******************************************/
60
61
    /**
62
     * @inheritdoc
63
     */
64
    protected function baseVariables(array &$variables = [])
65
    {
66
        parent::baseVariables($variables);
67
68
        $title = HubSpot::t("Settings");
69
        $variables['title'] .= ': ' . $title;
70
71
        // Breadcrumbs
72
        $variables['crumbs'][] = [
73
            'label' => $title,
74
            'url' => UrlHelper::url(HubSpot::getInstance()->getUniqueId())
75
        ];
76
    }
77
78
    /*******************************************
79
     * UPSERT VARIABLES
80
     *******************************************/
81
82
    /**
83
     * @param array $variables
84
     */
85
    protected function insertVariables(array &$variables)
86
    {
87
        $this->baseVariables($variables);
88
        $variables['continueEditingUrl'] = $this->getBaseContinueEditingUrl('/{id}');
89
        $variables['title'] .= ' - ' . HubSpot::t('New');
90
    }
91
}
92