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 |
||
21 | View Code Duplication | class RootQueryDatetimesConnection implements ConnectionInterface |
|
22 | { |
||
23 | |||
24 | /** |
||
25 | * @var EEM_Datetime $model |
||
26 | */ |
||
27 | protected $model; |
||
28 | |||
29 | |||
30 | /** |
||
31 | * DatetimeConnection constructor. |
||
32 | * |
||
33 | * @param EEM_Datetime $model |
||
34 | */ |
||
35 | public function __construct(EEM_Datetime $model) |
||
39 | |||
40 | |||
41 | /** |
||
42 | * @return array |
||
43 | * @since $VID:$ |
||
44 | */ |
||
45 | public function config() |
||
57 | |||
58 | |||
59 | /** |
||
60 | * @param $entity |
||
61 | * @param $args |
||
62 | * @param $context |
||
63 | * @param $info |
||
64 | * @return array |
||
65 | * @throws Exception |
||
66 | * @since $VID:$ |
||
67 | */ |
||
68 | public function resolveConnection($entity, $args, $context, $info) |
||
73 | |||
74 | |||
75 | /** |
||
76 | * @param $id |
||
77 | * @param $args |
||
78 | * @param $context |
||
79 | * @param $info |
||
80 | * @return EE_Base_Class |
||
81 | * @since $VID:$ |
||
82 | */ |
||
83 | public function resolveNode($id, $args, $context, $info) |
||
87 | } |
||
88 |