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 |
||
| 14 | class TVEpisode extends Item implements TVEpisodeInterface |
||
|
|
|||
| 15 | { |
||
| 16 | |||
| 17 | use ElementTrait; |
||
| 18 | use TVEpisodeTrait; |
||
| 19 | |||
| 20 | protected $season_number; |
||
| 21 | protected $episode_number; |
||
| 22 | 22 | ||
| 23 | public function __construct(Tmdb $tmdb, $tv_id, $season_number, $episode_number, array $options = array()) |
||
| 30 | |||
| 31 | /** |
||
| 32 | * Get TV show id |
||
| 33 | * @return int |
||
| 34 | 2 | */ |
|
| 35 | public function getId() |
||
| 43 | 2 | ||
| 44 | public function getAirDate() |
||
| 52 | 1 | ||
| 53 | public function getEpisodeNumber() |
||
| 61 | 1 | ||
| 62 | /** |
||
| 63 | * @codeCoverageIgnore |
||
| 64 | 1 | * @throws NotYetImplementedException |
|
| 65 | */ |
||
| 66 | 2 | public function getGuestStars() |
|
| 70 | 1 | ||
| 71 | public function getName() |
||
| 79 | |||
| 80 | public function getNote() |
||
| 88 | 1 | ||
| 89 | public function getNoteCount() |
||
| 97 | 1 | ||
| 98 | public function getOverview() |
||
| 106 | 1 | ||
| 107 | public function getProductionCode() |
||
| 115 | 1 | ||
| 116 | public function getSeasonNumber() |
||
| 124 | 1 | ||
| 125 | public function getStillPath() |
||
| 133 | 1 | ||
| 134 | View Code Duplication | public function getPosters() |
|
| 144 | 1 | ||
| 145 | } |
||
| 146 |