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 |
||
20 | class ClosingDate |
||
21 | { |
||
22 | protected $timezone; |
||
23 | |||
24 | public function __construct(DateTimeZone $timezone) |
||
28 | |||
29 | View Code Duplication | public function parse(DOMDocument $dom, DOMXPath $xpath) : DateTimeImmutable |
|
44 | |||
45 | private function clearClosingHour(string $closingHour) : string |
||
49 | } |
||
50 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.