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 OpeningDate |
||
| 21 | { |
||
| 22 | const OPENING_STRING = 'CfS opens at'; |
||
| 23 | |||
| 24 | protected $timezone; |
||
| 25 | |||
| 26 | public function __construct(DateTimeZone $timezone) |
||
| 30 | |||
| 31 | View Code Duplication | public function parse(DOMDocument $dom, DOMXPath $xpath) : DateTimeImmutable |
|
| 46 | |||
| 47 | private function clearOpeningHour(string $openingHour) : string |
||
| 51 | } |
||
| 52 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.