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 |
||
18 | View Code Duplication | class xsDouble extends xsAnySimpleType |
|
19 | { |
||
20 | use MinMaxTrait; |
||
21 | |||
22 | /** |
||
23 | * Construct. |
||
24 | * |
||
25 | * @param float $value |
||
26 | */ |
||
27 | public function __construct($value) |
||
28 | { |
||
29 | parent::__construct($value); |
||
30 | $this->setWhiteSpaceFacet('collapse'); |
||
31 | } |
||
32 | |||
33 | protected function fixValue() |
||
50 | |||
51 | protected function isOK() |
||
55 | } |
||
56 |