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 |
||
9 | class Extension extends CompilerExtension |
||
10 | { |
||
11 | |||
12 | public $defaults = [ |
||
13 | 'wwwDir' => '%wwwDir%', |
||
14 | 'versions' => AssetMacro::VERSIONS_AUTODETECT, |
||
15 | 'autodetectPaths' => [ |
||
16 | 'busters.json', |
||
17 | 'versions.json', |
||
18 | 'rev-manifest.json', |
||
19 | ], |
||
20 | 'missingAsset' => 'exception', // exception, notice, or ignore |
||
21 | 'missingVersion' => 'ignore', // exception, notice, or ignore |
||
22 | ]; |
||
23 | |||
24 | public function beforeCompile() |
||
43 | |||
44 | } |
||
45 |
This method has been deprecated.