Completed
Branch EDTR/fix-php-tests (bd0dd6)
by
unknown
19:34 queued 10:26
created

TicketMutation::prepare_fields()   A

Complexity

Conditions 3
Paths 4

Size

Total Lines 17

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 3
nc 4
nop 1
dl 0
loc 17
rs 9.7
c 0
b 0
f 0
1
<?php
2
3
namespace EventEspresso\core\domain\services\graphql\data\mutations;
4
5
/**
6
 * Class TicketMutation
7
 *
8
 * @package       Event Espresso
9
 * @author        Manzoor Wani
10
 */
11
class TicketMutation
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
     * @return array
19
     */
20
    public static function prepareFields(array $input)
21
    {
22
23
        $args = [];
24
25
        if (! empty($input['name'])) {
26
            $args['TKT_name'] = sanitize_text_field($input['name']);
27
        }
28
29
        if (! empty($input['description'])) {
30
            $args['TKT_description'] = sanitize_text_field($input['description']);
31
        }
32
33
        // Likewise the other fields...
34
35
        return $args;
36
    }
37
}
38