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 |
||
26 | View Code Duplication | abstract class PaginatorFactoryAbstract implements FactoryInterface,MutableCreationOptionsInterface |
|
27 | { |
||
28 | /** |
||
29 | * @var array |
||
30 | */ |
||
31 | protected $options = []; |
||
32 | |||
33 | /** |
||
34 | * Set creation options |
||
35 | * |
||
36 | * @param array $options |
||
37 | * |
||
38 | * @return void |
||
39 | */ |
||
40 | public function setCreationOptions(array $options) |
||
44 | |||
45 | /** |
||
46 | * @return array |
||
47 | */ |
||
48 | public function getCreationOptions() |
||
52 | |||
53 | /** |
||
54 | * @param ServiceLocatorInterface $serviceLocator |
||
55 | * @return mixed|Paginator |
||
56 | */ |
||
57 | public function createService(ServiceLocatorInterface $serviceLocator) |
||
70 | |||
71 | /** |
||
72 | * pagination service name |
||
73 | * |
||
74 | * @return string |
||
75 | */ |
||
76 | abstract protected function getFilter(); |
||
77 | |||
78 | /** |
||
79 | * Get Solr Connect Path for this paginator |
||
80 | * |
||
81 | * @return string |
||
82 | */ |
||
83 | abstract protected function getConnectPath(); |
||
84 | } |
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.