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 |
||
18 | class View extends \yii\web\View |
||
19 | { |
||
20 | |||
21 | /** |
||
22 | * @var bool |
||
23 | */ |
||
24 | public $enableMinify = true; |
||
25 | |||
26 | /** |
||
27 | * @var string filemtime or sha1 |
||
28 | */ |
||
29 | public $fileCheckAlgorithm = 'sha1'; |
||
30 | |||
31 | /** |
||
32 | * @var bool |
||
33 | */ |
||
34 | public $concatCss = true; |
||
35 | |||
36 | /** |
||
37 | * @var bool |
||
38 | */ |
||
39 | public $minifyCss = true; |
||
40 | |||
41 | /** |
||
42 | * @var bool |
||
43 | */ |
||
44 | public $concatJs = true; |
||
45 | |||
46 | /** |
||
47 | * @var bool |
||
48 | */ |
||
49 | public $minifyJs = true; |
||
50 | |||
51 | /** |
||
52 | * @var bool |
||
53 | */ |
||
54 | public $minifyOutput = false; |
||
55 | |||
56 | /** |
||
57 | * @var bool |
||
58 | */ |
||
59 | public $removeComments = true; |
||
60 | |||
61 | /** |
||
62 | * @var string path alias to web base (in url) |
||
63 | */ |
||
64 | public $web_path = '@web'; |
||
65 | |||
66 | /** |
||
67 | * @var string path alias to web base (absolute) |
||
68 | */ |
||
69 | public $base_path = '@webroot'; |
||
70 | |||
71 | /** |
||
72 | * @var string path alias to save minify result |
||
73 | */ |
||
74 | public $minify_path = '@webroot/minify'; |
||
75 | |||
76 | /** |
||
77 | * @var array positions of js files to be minified |
||
78 | */ |
||
79 | public $js_position = [self::POS_END, self::POS_HEAD]; |
||
80 | |||
81 | /** |
||
82 | * @var bool|string charset forcibly assign, otherwise will use all of the files found charset |
||
83 | */ |
||
84 | public $force_charset = false; |
||
85 | |||
86 | /** |
||
87 | * @var bool whether to change @import on content |
||
88 | */ |
||
89 | public $expand_imports = true; |
||
90 | |||
91 | /** |
||
92 | * @var int |
||
93 | */ |
||
94 | public $css_linebreak_pos = 2048; |
||
95 | |||
96 | /** |
||
97 | * @var int|bool chmod of minified file. If false chmod not set |
||
98 | */ |
||
99 | public $file_mode = 0664; |
||
100 | |||
101 | /** |
||
102 | * @var array schemes that will be ignored during normalization url |
||
103 | */ |
||
104 | public $schemas = ['//', 'http://', 'https://', 'ftp://']; |
||
105 | |||
106 | /** |
||
107 | * @deprecated |
||
108 | * @var bool do I need to compress the result html page. |
||
109 | */ |
||
110 | public $compress_output = false; |
||
111 | |||
112 | /** |
||
113 | * @var array options for compressing output result |
||
114 | * * extra - use more compact algorithm |
||
115 | * * no-comments - cut all the html comments |
||
116 | */ |
||
117 | public $compress_options = ['extra' => true]; |
||
118 | |||
119 | /** |
||
120 | * @var array |
||
121 | */ |
||
122 | public $excludeBundles = []; |
||
123 | |||
124 | /** |
||
125 | * @throws \rmrevin\yii\minify\Exception |
||
126 | */ |
||
127 | 9 | public function init() |
|
161 | |||
162 | /** |
||
163 | * @inheritdoc |
||
164 | */ |
||
165 | 7 | public function endBody() |
|
187 | } |
||
188 |
This property has been deprecated. The supplier of the class has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the property will be removed from the class and what other property to use instead.