Code Duplication    Length = 34-34 lines in 2 locations

core/domain/services/graphql/data/mutations/EventMutation.php 1 location

@@ 11-44 (lines=34) @@
8
 * @package       Event Espresso
9
 * @author        Manzoor Wani
10
 */
11
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)
22
    {
23
24
        $args = [];
25
26
        if (! empty($input['name'])) {
27
            $args['EVT_name'] = sanitize_text_field($input['name']);
28
        }
29
30
        if (! empty($input['desc'])) {
31
            $args['EVT_desc'] = sanitize_text_field($input['desc']);
32
        }
33
34
        if (! empty($input['shortDesc'])) {
35
            $args['EVT_short_desc'] = sanitize_text_field($input['shortDesc']);
36
        }
37
38
        // Likewise the other fields...
39
40
        return $args;
41
    }
42
}
43

core/domain/services/graphql/data/mutations/VenueMutation.php 1 location

@@ 11-44 (lines=34) @@
8
 * @package       Event Espresso
9
 * @author        Manzoor Wani
10
 */
11
class VenueMutation
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)
22
    {
23
24
        $args = [];
25
26
        if (! empty($input['name'])) {
27
            $args['VNU_name'] = sanitize_text_field($input['name']);
28
        }
29
30
        if (! empty($input['desc'])) {
31
            $args['VNU_desc'] = sanitize_text_field($input['desc']);
32
        }
33
34
        if (! empty($input['shortDesc'])) {
35
            $args['VNU_short_desc'] = sanitize_text_field($input['shortDesc']);
36
        }
37
38
        // Likewise the other fields...
39
40
        return $args;
41
    }
42
}
43