| Total Complexity | 8 |
| Total Lines | 71 |
| Duplicated Lines | 19.72 % |
| Coverage | 94.12% |
| Changes | 0 | ||
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 |
||
| 13 | class TransferMetadata extends ClassMetadata |
||
| 14 | { |
||
| 15 | /** |
||
| 16 | * @var PropertyMetadata |
||
| 17 | */ |
||
| 18 | public $id; |
||
| 19 | |||
| 20 | /** |
||
| 21 | * @var PropertyMetadata[] |
||
| 22 | */ |
||
| 23 | public $associations = []; |
||
| 24 | |||
| 25 | 20 | public function addPropertyMetadata(BasePropertyMetadata $metadata) |
|
| 45 | } |
||
| 46 | |||
| 47 | /** |
||
| 48 | * @param string $name |
||
| 49 | * @return PropertyMetadata |
||
| 50 | */ |
||
| 51 | public function getAssociation(string $name) |
||
| 52 | { |
||
| 53 | return $this->associations[$name] ?? null; |
||
| 54 | } |
||
| 55 | |||
| 56 | 4 | public function serialize() |
|
| 67 | )); |
||
| 68 | } |
||
| 69 | |||
| 70 | 3 | View Code Duplication | public function unserialize($str) |
| 84 | 3 | } |
|
| 85 | } |
||
| 86 |