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 declare(strict_types=1); |
||
| 10 | class FacebookServiceAdapter extends AbstractServiceAdapter |
||
| 11 | { |
||
| 12 | const THUMBNAIL_SIZE_DEFAULT = 'default'; |
||
| 13 | |||
| 14 | public function __construct(string $url, string $pattern, EmbedRendererInterface $renderer) |
||
| 22 | |||
| 23 | public function getServiceName(): string |
||
| 27 | |||
| 28 | public function hasThumbnail(): bool |
||
| 32 | |||
| 33 | public function getThumbNailSizes(): array |
||
| 37 | |||
| 38 | View Code Duplication | public function getThumbnail(string $size, bool $forceSecure = false): string |
|
| 46 | |||
| 47 | /** |
||
| 48 | * @throws ThumbnailSizeNotAvailable |
||
| 49 | */ |
||
| 50 | public function getSmallThumbnail(bool $forceSecure = false): string |
||
| 54 | |||
| 55 | /** |
||
| 56 | * @throws InvalidThumbnailSizeException |
||
| 57 | */ |
||
| 58 | public function getMediumThumbnail(bool $forceSecure = false): string |
||
| 62 | |||
| 63 | /** |
||
| 64 | * @throws ThumbnailSizeNotAvailable |
||
| 65 | */ |
||
| 66 | public function getLargeThumbnail(bool $forceSecure = false): string |
||
| 70 | |||
| 71 | /** |
||
| 72 | * @throws InvalidThumbnailSizeException |
||
| 73 | */ |
||
| 74 | public function getLargestThumbnail(bool $forceSecure = false): string |
||
| 78 | |||
| 79 | public function getEmbedUrl(bool $forceAutoplay = false, bool $forceSecure = false): string |
||
| 83 | |||
| 84 | public function isEmbeddable(): bool |
||
| 88 | } |
||
| 89 |