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 |
||
18 | View Code Duplication | class RootQueryPricesConnection extends AbstractRootQueryConnection |
|
19 | { |
||
20 | |||
21 | /** |
||
22 | * @var EEM_Price $model |
||
23 | */ |
||
24 | protected $model; |
||
25 | |||
26 | |||
27 | /** |
||
28 | * PriceConnection constructor. |
||
29 | * |
||
30 | * @param EEM_Price $model |
||
31 | */ |
||
32 | public function __construct(EEM_Price $model) |
||
36 | |||
37 | |||
38 | /** |
||
39 | * @return array |
||
40 | * @since $VID:$ |
||
41 | */ |
||
42 | public function config() |
||
54 | |||
55 | |||
56 | /** |
||
57 | * @param $entity |
||
58 | * @param $args |
||
59 | * @param $context |
||
60 | * @param $info |
||
61 | * @return PriceConnectionResolver |
||
62 | * @throws Exception |
||
63 | * @since $VID:$ |
||
64 | */ |
||
65 | public function getConnectionResolver($entity, $args, $context, $info) |
||
69 | } |
||
70 |