EditController   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 33
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 33
c 0
b 0
f 0
ccs 0
cts 22
cp 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A beforeRender() 0 21 2
A getPlugin() 0 4 1
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: dsmrt
5
 * Date: 3/18/18
6
 * Time: 9:53 PM
7
 */
8
9
namespace flipbox\saml\sp\controllers\cp\view\keychain;
10
11
use craft\base\Plugin;
12
use flipbox\keychain\controllers\cp\view\AbstractEditController;
13
use flipbox\saml\sp\Saml;
14
15
class EditController extends AbstractEditController
16
{
17
    protected function getPlugin(): Plugin
18
    {
19
        return Saml::getInstance();
20
    }
21
22
    /**
23
     * @param array $variables
24
     * @return array
25
     */
26
    protected function beforeRender(array $variables = [])
27
    {
28
        $request = \Craft::$app->request;
29
30
        $key = null;
31
        $path = implode(
32
            '/',
33
            [
34
                $request->getSegment(2),
35
                $request->getSegment(3),
36
                $request->getSegment(4),
37
            ]
38
        );
39
40
        if (preg_match('#keychain/#', $path)) {
41
            $key = 'saml.keychain';
42
        }
43
44
        $variables['selectedSubnavItem'] = $key;
45
        return parent::beforeRender($variables);
46
    }
47
}
48