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 |
||
11 | View Code Duplication | class EventMutation |
|
12 | { |
||
13 | |||
14 | /** |
||
15 | * Maps the GraphQL input to a format that the model functions can use |
||
16 | * |
||
17 | * @param array $input Data coming from the GraphQL mutation query input |
||
18 | * @param string $mutation_name Name of the mutation being performed |
||
19 | * @return array |
||
20 | */ |
||
21 | public static function prepareFields(array $input, $mutation_name) |
||
42 | } |
||
43 |