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 |
||
| 17 | class ContentProxy extends APIContent |
||
| 18 | { |
||
| 19 | use GeneratorProxyTrait; |
||
| 20 | |||
| 21 | /** |
||
| 22 | * @var \eZ\Publish\API\Repository\Values\Content\Content|null |
||
| 23 | */ |
||
| 24 | protected $object; |
||
| 25 | |||
| 26 | public function getVersionInfo() |
||
| 34 | |||
| 35 | View Code Duplication | public function getFieldValue($fieldDefIdentifier, $languageCode = null) |
|
| 43 | |||
| 44 | public function getFields() |
||
| 52 | |||
| 53 | public function getFieldsByLanguage($languageCode = null) |
||
| 61 | |||
| 62 | View Code Duplication | public function getField($fieldDefIdentifier, $languageCode = null) |
|
| 70 | } |
||
| 71 |