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 |
||
| 22 | class NotConstraint implements Constraint |
||
| 23 | { |
||
| 24 | /** |
||
| 25 | * {@inheritdoc} |
||
| 26 | */ |
||
| 27 | 373 | public function keywords() |
|
| 31 | |||
| 32 | /** |
||
| 33 | * {@inheritdoc} |
||
| 34 | */ |
||
| 35 | 357 | public function supports($type) |
|
| 39 | |||
| 40 | /** |
||
| 41 | * {@inheritdoc} |
||
| 42 | */ |
||
| 43 | 17 | public function normalize(stdClass $schema, Context $context, Walker $walker) |
|
| 54 | |||
| 55 | /** |
||
| 56 | * {@inheritdoc} |
||
| 57 | */ |
||
| 58 | 14 | View Code Duplication | public function apply($instance, stdClass $schema, Context $context, Walker $walker) |
| 67 | } |
||
| 68 |