GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

BaseThemeConfigurationModel   A
last analyzed

Complexity

Total Complexity 8

Size/Duplication

Total Lines 87
Duplicated Lines 16.09 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 8
lcom 1
cbo 1
dl 14
loc 87
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A defaultValues() 0 4 1
A webApplicationAttributes() 0 10 1
A consoleApplicationAttributes() 0 4 1
A commonApplicationAttributes() 0 4 1
A keyValueAttributes() 0 4 1
A aliases() 14 14 3

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
3
namespace app\models;
4
5
use app;
6
use Yii;
7
8
class BaseThemeConfigurationModel extends app\modules\config\models\BaseConfigurationModel
9
{
10
    /**
11
     * @var bool Should this theme be registered as @theme alias in config
12
     */
13
    public $registerThemeAlias = true;
14
15
    /**
16
     * Fills model attributes with default values
17
     * @return void
18
     */
19
    public function defaultValues()
20
    {
21
        return;
22
    }
23
24
    /**
25
     * Returns array of module configuration that should be stored in application config.
26
     * Array should be ready to merge in app config.
27
     * Used both for web only.
28
     *
29
     * @return array
0 ignored issues
show
Documentation introduced by
Consider making the return type a bit more specific; maybe use array<string,array<string,array>>.

This check looks for the generic type array as a return type and suggests a more specific type. This type is inferred from the actual code.

Loading history...
30
     */
31
    public function webApplicationAttributes()
32
    {
33
        return [
34
            'modules' => [
35
                $this->getModule() => [
36
                    'class' => $this->getModuleInstance()->className(),
37
                ],
38
            ]
39
        ];
40
    }
41
42
    /**
43
     * Returns array of module configuration that should be stored in application config.
44
     * Array should be ready to merge in app config.
45
     * Used both for console only.
46
     *
47
     * @return array
48
     */
49
    public function consoleApplicationAttributes()
50
    {
51
        return [];
52
    }
53
54
    /**
55
     * Returns array of module configuration that should be stored in application config.
56
     * Array should be ready to merge in app config.
57
     * Used both for web and console.
58
     *
59
     * @return array
60
     */
61
    public function commonApplicationAttributes()
62
    {
63
        return [];
64
    }
65
66
    /**
67
     * Returns array of key=>values for configuration.
68
     *
69
     * @return mixed
70
     */
71
    public function keyValueAttributes()
72
    {
73
        return [];
74
    }
75
76
    /**
77
     * Returns array of aliases that should be set in common config
78
     * @return array
79
     */
80 View Code Duplication
    public function aliases()
81
    {
82
        if ($this->registerThemeAlias === true) {
83
            if ($this->getModuleInstance() !== null) {
84
                $reflectionClass = new \ReflectionClass($this->getModuleInstance());
85
                return [
86
                    '@' . $this->getModule() => dirname($reflectionClass->getFileName()),
87
                ];
88
            }
89
        }
90
91
        return [];
92
93
    }
94
}