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 |
||
16 | final class KvkClient implements KvkClientInterface, KvkPaginatorAwareInterface |
||
17 | { |
||
18 | /** |
||
19 | * @var ClientInterface |
||
20 | */ |
||
21 | private $httpClient; |
||
22 | |||
23 | /** |
||
24 | * @var KvkPaginatorFactoryInterface |
||
25 | */ |
||
26 | private $profileResponseFactory; |
||
27 | |||
28 | 21 | public function __construct(ClientInterface $httpClient, KvkPaginatorFactoryInterface $profileResponseFactory) |
|
33 | |||
34 | 19 | View Code Duplication | public function getProfile(QueryInterface $profileQuery): KvkPaginatorInterface |
41 | |||
42 | 1 | View Code Duplication | public function getNextPage(KvkPaginatorInterface $kvkPaginator): KvkPaginatorInterface |
49 | |||
50 | 1 | View Code Duplication | public function getPreviousPage(KvkPaginatorInterface $kvkPaginator): KvkPaginatorInterface |
57 | |||
58 | 19 | private function decodeJsonToArray(string $json): array |
|
78 | } |
||
79 |