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 |
||
19 | class DatetimeTicketsConnection extends ConnectionBase |
||
20 | { |
||
21 | |||
22 | |||
23 | /** |
||
24 | * DatetimeConnection constructor. |
||
25 | * |
||
26 | * @param EEM_Ticket $model |
||
27 | */ |
||
28 | public function __construct(EEM_Ticket $model) |
||
32 | |||
33 | |||
34 | /** |
||
35 | * @return array |
||
36 | * @since $VID:$ |
||
37 | */ |
||
38 | View Code Duplication | public function config() |
|
49 | |||
50 | |||
51 | /** |
||
52 | * @param $entity |
||
53 | * @param $args |
||
54 | * @param $context |
||
55 | * @param $info |
||
56 | * @return array |
||
57 | * @throws Exception |
||
58 | * @since $VID:$ |
||
59 | */ |
||
60 | public function resolveConnection($entity, $args, $context, $info) |
||
65 | |||
66 | /** |
||
67 | * Given an optional array of args, this returns the args to be used in the connection |
||
68 | * |
||
69 | * @access public |
||
70 | * @param array $args The args to modify the defaults |
||
71 | * |
||
72 | * @return array |
||
73 | */ |
||
74 | // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps |
||
75 | public static function get_connection_args($args = []) |
||
103 | } |
||
104 |