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 |
||
5 | final class GridOptions |
||
6 | { |
||
7 | private $variant; |
||
8 | private $page; |
||
|
|||
9 | private $pageSize; |
||
10 | private $orderings; |
||
11 | |||
12 | public function __construct(array $options) |
||
35 | |||
36 | public function getCurrentPage() |
||
37 | { |
||
38 | return $this->currentPage; |
||
39 | } |
||
40 | |||
41 | public function getPageSize() |
||
45 | |||
46 | public function getPageOffset() |
||
50 | |||
51 | public function getOrderings() |
||
55 | |||
56 | public function getVariant() |
||
60 | } |
||
61 |
This check marks private properties in classes that are never used. Those properties can be removed.