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

LimitsController   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 55
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 3
dl 0
loc 55
ccs 0
cts 24
cp 0
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A actionIndex() 0 19 1
A getBaseCpPath() 0 4 1
A getBaseActionPath() 0 4 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\hubspot\criteria\HubCriteria;
12
use flipbox\craft\hubspot\transformers\DynamicModelResponse;
13
use yii\web\Response;
14
15
/**
16
 * @author Flipbox Factory <[email protected]>
17
 * @since 1.0.0
18
 */
19
class LimitsController extends AbstractController
20
{
21
    /**
22
     * The template base path
23
     */
24
    const TEMPLATE_BASE = parent::TEMPLATE_BASE . '/limits';
25
26
    /**
27
     * The index view template path
28
     */
29
    const TEMPLATE_INDEX = self::TEMPLATE_BASE . '/index';
30
31
    /**
32
     * @return Response
33
     */
34
    public function actionIndex(): Response
35
    {
36
        $variables = [];
37
        $this->baseVariables($variables);
38
39
        $criteria = new HubCriteria();
40
41
        $variables['limits'] = call_user_func_array(
42
            new DynamicModelResponse(),
43
            [
44
                $criteria->dailyLimit()
45
            ]
46
        );
47
48
        return $this->renderTemplate(
49
            static::TEMPLATE_INDEX,
50
            $variables
51
        );
52
    }
53
54
    /*******************************************
55
     * BASE PATHS
56
     *******************************************/
57
58
    /**
59
     * @return string
60
     */
61
    protected function getBaseCpPath(): string
62
    {
63
        return parent::getBaseCpPath() . '/limits';
64
    }
65
66
    /**
67
     * @return string
68
     */
69
    protected function getBaseActionPath(): string
70
    {
71
        return parent::getBaseActionPath() . '/limits';
72
    }
73
}
74