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 |
||
3 | class Kint_Parser_Blacklist extends Kint_Parser_Plugin |
||
4 | { |
||
5 | /** |
||
6 | * List of classes and interfaces to blacklist. |
||
7 | * |
||
8 | * @var array |
||
9 | */ |
||
10 | public static $blacklist = array(); |
||
11 | |||
12 | /** |
||
13 | * List of classes and interfaces to blacklist except when dumped directly. |
||
14 | * |
||
15 | * @var array |
||
16 | */ |
||
17 | public static $shallow_blacklist = array(); |
||
18 | |||
19 | public function getTypes() |
||
23 | |||
24 | public function getTriggers() |
||
28 | |||
29 | public function parse(&$var, Kint_Object &$o, $trigger) |
||
47 | |||
48 | protected function blacklist(&$var, &$o) |
||
73 | } |
||
74 |
This check examines a number of code elements and verifies that they conform to the given naming conventions.
You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.