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 |
||
11 | abstract class KintTestCase extends PHPUnit_Framework_TestCase |
||
12 | { |
||
13 | protected $kint_status; |
||
14 | protected $char_encodings; |
||
15 | protected $text_decorations; |
||
16 | protected $text_plugin_whitelist; |
||
17 | |||
18 | View Code Duplication | public function setUp() |
|
25 | |||
26 | View Code Duplication | public function tearDown() |
|
33 | |||
34 | /** |
||
35 | * Asserts that a condition is true. |
||
36 | * |
||
37 | * @param array $expected |
||
38 | * @param string $actual |
||
39 | * @param string $message |
||
40 | * |
||
41 | * @throws PHPUnit_Framework_Exception |
||
42 | */ |
||
43 | public function assertLike(array $expected, $actual, $message = '') |
||
51 | } |
||
52 |
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.