Code Duplication    Length = 4-4 lines in 7 locations

core/domain/services/graphql/data/mutations/DatetimeMutation.php 2 locations

@@ 49-52 (lines=4) @@
46
47
        if (! empty($input['eventId'])) {
48
            $args['EVT_ID'] = absint($input['eventId']);
49
        } elseif (! empty($input['event'])) {
50
            $parts = Relay::fromGlobalId(sanitize_text_field($input['event']));
51
            $args['EVT_ID'] = (! empty($parts['id']) && is_int($parts['id'])) ? $parts['id'] : null;
52
        }
53
54
        if (array_key_exists('isPrimary', $input)) {
55
            $args['DTT_is_primary'] = (bool) $input['isPrimary'];
@@ 70-73 (lines=4) @@
67
            $args['DTT_order'] = (int) $input['order'];
68
        }
69
70
        if (! empty($input['parent'])) {
71
            $parts = Relay::fromGlobalId(sanitize_text_field($input['parent']));
72
            $args['DTT_parent'] = (! empty($parts['id']) && is_int($parts['id'])) ? $parts['id'] : null;
73
        }
74
75
        if (array_key_exists('reserved', $input)) {
76
            $args['DTT_reserved'] = (int) $input['reserved'];

core/domain/services/graphql/data/mutations/PriceMutation.php 3 locations

@@ 54-57 (lines=4) @@
51
            $args['PRC_overrides'] = (int) $input['overrides'];
52
        }
53
54
        if (! empty($input['parent'])) {
55
            $parts = Relay::fromGlobalId(sanitize_text_field($input['parent']));
56
            $args['PRC_parent'] = ! empty($parts['id']) ? absint($parts['id']) : 0;
57
        }
58
59
        if (! empty($input['priceType'])) {
60
            $parts = Relay::fromGlobalId(sanitize_text_field($input['priceType']));
@@ 59-62 (lines=4) @@
56
            $args['PRC_parent'] = ! empty($parts['id']) ? absint($parts['id']) : 0;
57
        }
58
59
        if (! empty($input['priceType'])) {
60
            $parts = Relay::fromGlobalId(sanitize_text_field($input['priceType']));
61
            $args['PRT_ID'] = ! empty($parts['id']) ? absint($parts['id']) : 0;
62
        }
63
64
        if (! empty($input['wpUser'])) {
65
            $parts = Relay::fromGlobalId(sanitize_text_field($input['wpUser']));
@@ 64-67 (lines=4) @@
61
            $args['PRT_ID'] = ! empty($parts['id']) ? absint($parts['id']) : 0;
62
        }
63
64
        if (! empty($input['wpUser'])) {
65
            $parts = Relay::fromGlobalId(sanitize_text_field($input['wpUser']));
66
            $args['PRC_wp_user'] = (! empty($parts['id']) && is_int($parts['id'])) ? $parts['id'] : null;
67
        }
68
69
        return $args;
70
    }

core/domain/services/graphql/data/mutations/TicketMutation.php 2 locations

@@ 85-88 (lines=4) @@
82
            $args['TKT_order'] = (int) $input['order'];
83
        }
84
85
        if (! empty($input['parent'])) {
86
            $parts = Relay::fromGlobalId(sanitize_text_field($input['parent']));
87
            $args['TKT_parent'] = (! empty($parts['id']) && is_int($parts['id'])) ? $parts['id'] : null;
88
        }
89
90
        if (! empty($input['price'])) {
91
            $args['TKT_price'] = (float) $input['price'];
@@ 126-129 (lines=4) @@
123
            $args['TKT_uses'] = (int) $input['uses'];
124
        }
125
126
        if (! empty($input['wpUser'])) {
127
            $parts = Relay::fromGlobalId(sanitize_text_field($input['wpUser']));
128
            $args['TKT_wp_user'] = (! empty($parts['id']) && is_int($parts['id'])) ? $parts['id'] : null;
129
        }
130
131
        return $args;
132
    }