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 EspressoCoreAppAssetManager extends ReactAssetManager |
||
19 | { |
||
20 | const JS_HANDLE_EDITOR = 'eventespresso-core-app'; |
||
21 | |||
22 | /** |
||
23 | * @throws InvalidDataTypeException |
||
24 | * @throws InvalidEntityException |
||
25 | * @throws DuplicateCollectionIdentifierException |
||
26 | * @throws DomainException |
||
27 | */ |
||
28 | public function addAssets() |
||
33 | |||
34 | |||
35 | /** |
||
36 | * Register javascript assets |
||
37 | * |
||
38 | * @throws InvalidDataTypeException |
||
39 | * @throws InvalidEntityException |
||
40 | * @throws DuplicateCollectionIdentifierException |
||
41 | * @throws DomainException |
||
42 | */ |
||
43 | View Code Duplication | private function registerJavascript() |
|
58 | } |
||
59 |