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 | trait ConfigureTrait |
||
10 | { |
||
11 | /** @var [] $config store the configuration in this array. */ |
||
|
|||
12 | private $config = []; |
||
13 | |||
14 | |||
15 | |||
16 | /** |
||
17 | * Read configuration from file or array, if a file, first check in |
||
18 | * ANAX_APP_PATH/config and then in ANAX_INSTALL_PATH/config. |
||
19 | * |
||
20 | * @param []|string $what is an array with key/value config options |
||
21 | * or a file to be included which returns such |
||
22 | * an array. |
||
23 | * |
||
24 | * @throws Exception when argument if not a filer nor an array. |
||
25 | * |
||
26 | * @return self for chaining. |
||
27 | */ |
||
28 | 4 | public function configure($what) |
|
53 | } |
||
54 |
This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.