Completed
Branch EDTR/master (bb716e)
by
unknown
57:55 queued 49:04
created
core/domain/services/graphql/types/Ticket.php 2 patches
Indentation   +263 added lines, -263 removed lines patch added patch discarded remove patch
@@ -25,273 +25,273 @@
 block discarded – undo
25 25
 class Ticket extends TypeBase
26 26
 {
27 27
 
28
-    /**
29
-     * Ticket constructor.
30
-     *
31
-     * @param EEM_Ticket $ticket_model
32
-     */
33
-    public function __construct(EEM_Ticket $ticket_model)
34
-    {
35
-        $this->model = $ticket_model;
36
-        $this->setName('Ticket');
37
-        $this->setDescription(__('A ticket for an event date', 'event_espresso'));
38
-        $this->setIsCustomPostType(false);
39
-        parent::__construct();
40
-    }
28
+	/**
29
+	 * Ticket constructor.
30
+	 *
31
+	 * @param EEM_Ticket $ticket_model
32
+	 */
33
+	public function __construct(EEM_Ticket $ticket_model)
34
+	{
35
+		$this->model = $ticket_model;
36
+		$this->setName('Ticket');
37
+		$this->setDescription(__('A ticket for an event date', 'event_espresso'));
38
+		$this->setIsCustomPostType(false);
39
+		parent::__construct();
40
+	}
41 41
 
42 42
 
43
-    /**
44
-     * @return GraphQLFieldInterface[]
45
-     * @since $VID:$
46
-     */
47
-    public function getFields()
48
-    {
49
-        return [
50
-            new GraphQLField(
51
-                'id',
52
-                ['non_null' => 'ID'],
53
-                null,
54
-                esc_html__('The globally unique ID for the object.', 'event_espresso')
55
-            ),
56
-            new GraphQLOutputField(
57
-                lcfirst($this->name()) . 'Id',
58
-                ['non_null' => 'Int'],
59
-                'ID',
60
-                esc_html__('Ticket ID', 'event_espresso')
61
-            ),
62
-            new GraphQLField(
63
-                'name',
64
-                'String',
65
-                'name',
66
-                esc_html__('Ticket Name', 'event_espresso')
67
-            ),
68
-            new GraphQLField(
69
-                'description',
70
-                'String',
71
-                'description',
72
-                esc_html__('Description of Ticket', 'event_espresso')
73
-            ),
74
-            new GraphQLField(
75
-                'startDate',
76
-                'String',
77
-                'start_date',
78
-                esc_html__('Start time/date of Ticket', 'event_espresso')
79
-            ),
80
-            new GraphQLField(
81
-                'endDate',
82
-                'String',
83
-                'end_date',
84
-                esc_html__('End time/date of Ticket', 'event_espresso')
85
-            ),
86
-            new GraphQLField(
87
-                'min',
88
-                'Int',
89
-                'min',
90
-                esc_html__('Minimum quantity of this ticket that must be purchased', 'event_espresso')
91
-            ),
92
-            new GraphQLField(
93
-                'max',
94
-                'Int',
95
-                'max',
96
-                esc_html__(
97
-                    'Maximum quantity of this ticket that can be purchased in one transaction',
98
-                    'event_espresso'
99
-                ),
100
-                [$this, 'parseInfiniteValue']
101
-            ),
102
-            new GraphQLField(
103
-                'price',
104
-                'Float',
105
-                'price',
106
-                esc_html__('Final calculated price for ticket', 'event_espresso')
107
-            ),
108
-            new GraphQLField(
109
-                'sold',
110
-                'Int',
111
-                'sold',
112
-                esc_html__('Number of this ticket sold', 'event_espresso')
113
-            ),
114
-            new GraphQLField(
115
-                'quantity',
116
-                'Int',
117
-                'qty',
118
-                esc_html__('Quantity of this ticket that is available', 'event_espresso'),
119
-                [$this, 'parseInfiniteValue']
120
-            ),
121
-            new GraphQLField(
122
-                'reserved',
123
-                'Int',
124
-                'reserved',
125
-                esc_html__(
126
-                    'Quantity of this ticket that is reserved, but not yet fully purchased',
127
-                    'event_espresso'
128
-                )
129
-            ),
130
-            new GraphQLField(
131
-                'uses',
132
-                'Int',
133
-                'uses',
134
-                esc_html__('Number of datetimes this ticket can be used at', 'event_espresso'),
135
-                [$this, 'parseInfiniteValue']
136
-            ),
137
-            new GraphQLField(
138
-                'isRequired',
139
-                'Boolean',
140
-                'required',
141
-                esc_html__(
142
-                    'Flag indicating whether this ticket must be purchased with a transaction',
143
-                    'event_espresso'
144
-                )
145
-            ),
146
-            new GraphQLField(
147
-                'isTaxable',
148
-                'Boolean',
149
-                'taxable',
150
-                esc_html__(
151
-                    'Flag indicating whether there is tax applied on this ticket',
152
-                    'event_espresso'
153
-                )
154
-            ),
155
-            new GraphQLField(
156
-                'isDefault',
157
-                'Boolean',
158
-                'is_default',
159
-                esc_html__('Flag indicating that this ticket is a default ticket', 'event_espresso')
160
-            ),
161
-            new GraphQLField(
162
-                'order',
163
-                'Int',
164
-                'order',
165
-                esc_html__('The order in which the Datetime is displayed', 'event_espresso')
166
-            ),
167
-            new GraphQLField(
168
-                'row',
169
-                'Int',
170
-                'row',
171
-                esc_html__('How tickets are displayed in the ui', 'event_espresso')
172
-            ),
173
-            new GraphQLOutputField(
174
-                'wpUser',
175
-                'User',
176
-                null,
177
-                esc_html__('Ticket Creator', 'event_espresso')
178
-            ),
179
-            new GraphQLInputField(
180
-                'wpUser',
181
-                'Int',
182
-                null,
183
-                esc_html__('Ticket Creator ID', 'event_espresso')
184
-            ),
185
-            new GraphQLOutputField(
186
-                'parent',
187
-                'Ticket',
188
-                null,
189
-                esc_html__('The parent ticket of the current ticket', 'event_espresso')
190
-            ),
191
-            new GraphQLInputField(
192
-                'parent',
193
-                'Int',
194
-                null,
195
-                esc_html__('The parent ticket ID', 'event_espresso')
196
-            ),
197
-            new GraphQLField(
198
-                'reverseCalculate',
199
-                'Boolean',
200
-                'reverse_calculate',
201
-                esc_html__(
202
-                    'Flag indicating whether ticket calculations should run in reverse and calculate the base ticket price from the provided ticket total.',
203
-                    'event_espresso'
204
-                )
205
-            ),
206
-            new GraphQLField(
207
-                'isFree',
208
-                'Boolean',
209
-                'is_free',
210
-                esc_html__('Flag indicating whether the ticket is free.', 'event_espresso')
211
-            ),
212
-            new GraphQLOutputField(
213
-                'event',
214
-                'Event',
215
-                null,
216
-                esc_html__('Event of the ticket.', 'event_espresso')
217
-            ),
218
-            new GraphQLInputField(
219
-                'datetimes',
220
-                ['list_of' => 'ID'],
221
-                null,
222
-                sprintf(
223
-                    '%1$s %2$s',
224
-                    esc_html__('Globally unique IDs of the datetimes related to the ticket.', 'event_espresso'),
225
-                    esc_html__('Ignored if empty.', 'event_espresso')
226
-                )
227
-            ),
228
-        ];
229
-    }
43
+	/**
44
+	 * @return GraphQLFieldInterface[]
45
+	 * @since $VID:$
46
+	 */
47
+	public function getFields()
48
+	{
49
+		return [
50
+			new GraphQLField(
51
+				'id',
52
+				['non_null' => 'ID'],
53
+				null,
54
+				esc_html__('The globally unique ID for the object.', 'event_espresso')
55
+			),
56
+			new GraphQLOutputField(
57
+				lcfirst($this->name()) . 'Id',
58
+				['non_null' => 'Int'],
59
+				'ID',
60
+				esc_html__('Ticket ID', 'event_espresso')
61
+			),
62
+			new GraphQLField(
63
+				'name',
64
+				'String',
65
+				'name',
66
+				esc_html__('Ticket Name', 'event_espresso')
67
+			),
68
+			new GraphQLField(
69
+				'description',
70
+				'String',
71
+				'description',
72
+				esc_html__('Description of Ticket', 'event_espresso')
73
+			),
74
+			new GraphQLField(
75
+				'startDate',
76
+				'String',
77
+				'start_date',
78
+				esc_html__('Start time/date of Ticket', 'event_espresso')
79
+			),
80
+			new GraphQLField(
81
+				'endDate',
82
+				'String',
83
+				'end_date',
84
+				esc_html__('End time/date of Ticket', 'event_espresso')
85
+			),
86
+			new GraphQLField(
87
+				'min',
88
+				'Int',
89
+				'min',
90
+				esc_html__('Minimum quantity of this ticket that must be purchased', 'event_espresso')
91
+			),
92
+			new GraphQLField(
93
+				'max',
94
+				'Int',
95
+				'max',
96
+				esc_html__(
97
+					'Maximum quantity of this ticket that can be purchased in one transaction',
98
+					'event_espresso'
99
+				),
100
+				[$this, 'parseInfiniteValue']
101
+			),
102
+			new GraphQLField(
103
+				'price',
104
+				'Float',
105
+				'price',
106
+				esc_html__('Final calculated price for ticket', 'event_espresso')
107
+			),
108
+			new GraphQLField(
109
+				'sold',
110
+				'Int',
111
+				'sold',
112
+				esc_html__('Number of this ticket sold', 'event_espresso')
113
+			),
114
+			new GraphQLField(
115
+				'quantity',
116
+				'Int',
117
+				'qty',
118
+				esc_html__('Quantity of this ticket that is available', 'event_espresso'),
119
+				[$this, 'parseInfiniteValue']
120
+			),
121
+			new GraphQLField(
122
+				'reserved',
123
+				'Int',
124
+				'reserved',
125
+				esc_html__(
126
+					'Quantity of this ticket that is reserved, but not yet fully purchased',
127
+					'event_espresso'
128
+				)
129
+			),
130
+			new GraphQLField(
131
+				'uses',
132
+				'Int',
133
+				'uses',
134
+				esc_html__('Number of datetimes this ticket can be used at', 'event_espresso'),
135
+				[$this, 'parseInfiniteValue']
136
+			),
137
+			new GraphQLField(
138
+				'isRequired',
139
+				'Boolean',
140
+				'required',
141
+				esc_html__(
142
+					'Flag indicating whether this ticket must be purchased with a transaction',
143
+					'event_espresso'
144
+				)
145
+			),
146
+			new GraphQLField(
147
+				'isTaxable',
148
+				'Boolean',
149
+				'taxable',
150
+				esc_html__(
151
+					'Flag indicating whether there is tax applied on this ticket',
152
+					'event_espresso'
153
+				)
154
+			),
155
+			new GraphQLField(
156
+				'isDefault',
157
+				'Boolean',
158
+				'is_default',
159
+				esc_html__('Flag indicating that this ticket is a default ticket', 'event_espresso')
160
+			),
161
+			new GraphQLField(
162
+				'order',
163
+				'Int',
164
+				'order',
165
+				esc_html__('The order in which the Datetime is displayed', 'event_espresso')
166
+			),
167
+			new GraphQLField(
168
+				'row',
169
+				'Int',
170
+				'row',
171
+				esc_html__('How tickets are displayed in the ui', 'event_espresso')
172
+			),
173
+			new GraphQLOutputField(
174
+				'wpUser',
175
+				'User',
176
+				null,
177
+				esc_html__('Ticket Creator', 'event_espresso')
178
+			),
179
+			new GraphQLInputField(
180
+				'wpUser',
181
+				'Int',
182
+				null,
183
+				esc_html__('Ticket Creator ID', 'event_espresso')
184
+			),
185
+			new GraphQLOutputField(
186
+				'parent',
187
+				'Ticket',
188
+				null,
189
+				esc_html__('The parent ticket of the current ticket', 'event_espresso')
190
+			),
191
+			new GraphQLInputField(
192
+				'parent',
193
+				'Int',
194
+				null,
195
+				esc_html__('The parent ticket ID', 'event_espresso')
196
+			),
197
+			new GraphQLField(
198
+				'reverseCalculate',
199
+				'Boolean',
200
+				'reverse_calculate',
201
+				esc_html__(
202
+					'Flag indicating whether ticket calculations should run in reverse and calculate the base ticket price from the provided ticket total.',
203
+					'event_espresso'
204
+				)
205
+			),
206
+			new GraphQLField(
207
+				'isFree',
208
+				'Boolean',
209
+				'is_free',
210
+				esc_html__('Flag indicating whether the ticket is free.', 'event_espresso')
211
+			),
212
+			new GraphQLOutputField(
213
+				'event',
214
+				'Event',
215
+				null,
216
+				esc_html__('Event of the ticket.', 'event_espresso')
217
+			),
218
+			new GraphQLInputField(
219
+				'datetimes',
220
+				['list_of' => 'ID'],
221
+				null,
222
+				sprintf(
223
+					'%1$s %2$s',
224
+					esc_html__('Globally unique IDs of the datetimes related to the ticket.', 'event_espresso'),
225
+					esc_html__('Ignored if empty.', 'event_espresso')
226
+				)
227
+			),
228
+		];
229
+	}
230 230
 
231 231
 
232
-    /**
233
-     * @param array $inputFields The mutation input fields.
234
-     * @throws InvalidArgumentException
235
-     * @throws ReflectionException
236
-     * @since $VID:$
237
-     */
238
-    public function registerMutations(array $inputFields)
239
-    {
240
-        // Register mutation to update an entity.
241
-        register_graphql_mutation(
242
-            'update' . $this->name(),
243
-            [
244
-                'inputFields'         => $inputFields,
245
-                'outputFields'        => [
246
-                    lcfirst($this->name()) => [
247
-                        'type'    => $this->name(),
248
-                        'resolve' => [$this, 'resolveFromPayload'],
249
-                    ],
250
-                ],
251
-                'mutateAndGetPayload' => TicketUpdate::mutateAndGetPayload($this->model, $this),
252
-            ]
253
-        );
254
-        // Register mutation to delete an entity.
255
-        register_graphql_mutation(
256
-            'delete' . $this->name(),
257
-            [
258
-                'inputFields'         => [
259
-                    'id'                => $inputFields['id'],
260
-                    'deletePermanently' => [
261
-                        'type'        => 'Boolean',
262
-                        'description' => esc_html__('Whether to delete the entity permanently.', 'event_espresso'),
263
-                    ],
264
-                ],
265
-                'outputFields'        => [
266
-                    lcfirst($this->name()) => [
267
-                        'type'        => $this->name(),
268
-                        'description' => esc_html__('The object before it was deleted', 'event_espresso'),
269
-                        'resolve'     => static function ($payload) {
270
-                            $deleted = (object) $payload['deleted'];
232
+	/**
233
+	 * @param array $inputFields The mutation input fields.
234
+	 * @throws InvalidArgumentException
235
+	 * @throws ReflectionException
236
+	 * @since $VID:$
237
+	 */
238
+	public function registerMutations(array $inputFields)
239
+	{
240
+		// Register mutation to update an entity.
241
+		register_graphql_mutation(
242
+			'update' . $this->name(),
243
+			[
244
+				'inputFields'         => $inputFields,
245
+				'outputFields'        => [
246
+					lcfirst($this->name()) => [
247
+						'type'    => $this->name(),
248
+						'resolve' => [$this, 'resolveFromPayload'],
249
+					],
250
+				],
251
+				'mutateAndGetPayload' => TicketUpdate::mutateAndGetPayload($this->model, $this),
252
+			]
253
+		);
254
+		// Register mutation to delete an entity.
255
+		register_graphql_mutation(
256
+			'delete' . $this->name(),
257
+			[
258
+				'inputFields'         => [
259
+					'id'                => $inputFields['id'],
260
+					'deletePermanently' => [
261
+						'type'        => 'Boolean',
262
+						'description' => esc_html__('Whether to delete the entity permanently.', 'event_espresso'),
263
+					],
264
+				],
265
+				'outputFields'        => [
266
+					lcfirst($this->name()) => [
267
+						'type'        => $this->name(),
268
+						'description' => esc_html__('The object before it was deleted', 'event_espresso'),
269
+						'resolve'     => static function ($payload) {
270
+							$deleted = (object) $payload['deleted'];
271 271
 
272
-                            return ! empty($deleted) ? $deleted : null;
273
-                        },
274
-                    ],
275
-                ],
276
-                'mutateAndGetPayload' => TicketDelete::mutateAndGetPayload($this->model, $this),
277
-            ]
278
-        );
272
+							return ! empty($deleted) ? $deleted : null;
273
+						},
274
+					],
275
+				],
276
+				'mutateAndGetPayload' => TicketDelete::mutateAndGetPayload($this->model, $this),
277
+			]
278
+		);
279 279
 
280
-        // remove primary key from input.
281
-        unset($inputFields['id']);
282
-        // Register mutation to update an entity.
283
-        register_graphql_mutation(
284
-            'create' . $this->name(),
285
-            [
286
-                'inputFields'         => $inputFields,
287
-                'outputFields'        => [
288
-                    lcfirst($this->name()) => [
289
-                        'type'    => $this->name(),
290
-                        'resolve' => [$this, 'resolveFromPayload'],
291
-                    ],
292
-                ],
293
-                'mutateAndGetPayload' => TicketCreate::mutateAndGetPayload($this->model, $this),
294
-            ]
295
-        );
296
-    }
280
+		// remove primary key from input.
281
+		unset($inputFields['id']);
282
+		// Register mutation to update an entity.
283
+		register_graphql_mutation(
284
+			'create' . $this->name(),
285
+			[
286
+				'inputFields'         => $inputFields,
287
+				'outputFields'        => [
288
+					lcfirst($this->name()) => [
289
+						'type'    => $this->name(),
290
+						'resolve' => [$this, 'resolveFromPayload'],
291
+					],
292
+				],
293
+				'mutateAndGetPayload' => TicketCreate::mutateAndGetPayload($this->model, $this),
294
+			]
295
+		);
296
+	}
297 297
 }
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
                 esc_html__('The globally unique ID for the object.', 'event_espresso')
55 55
             ),
56 56
             new GraphQLOutputField(
57
-                lcfirst($this->name()) . 'Id',
57
+                lcfirst($this->name()).'Id',
58 58
                 ['non_null' => 'Int'],
59 59
                 'ID',
60 60
                 esc_html__('Ticket ID', 'event_espresso')
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
     {
240 240
         // Register mutation to update an entity.
241 241
         register_graphql_mutation(
242
-            'update' . $this->name(),
242
+            'update'.$this->name(),
243 243
             [
244 244
                 'inputFields'         => $inputFields,
245 245
                 'outputFields'        => [
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
         );
254 254
         // Register mutation to delete an entity.
255 255
         register_graphql_mutation(
256
-            'delete' . $this->name(),
256
+            'delete'.$this->name(),
257 257
             [
258 258
                 'inputFields'         => [
259 259
                     'id'                => $inputFields['id'],
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
                     lcfirst($this->name()) => [
267 267
                         'type'        => $this->name(),
268 268
                         'description' => esc_html__('The object before it was deleted', 'event_espresso'),
269
-                        'resolve'     => static function ($payload) {
269
+                        'resolve'     => static function($payload) {
270 270
                             $deleted = (object) $payload['deleted'];
271 271
 
272 272
                             return ! empty($deleted) ? $deleted : null;
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
         unset($inputFields['id']);
282 282
         // Register mutation to update an entity.
283 283
         register_graphql_mutation(
284
-            'create' . $this->name(),
284
+            'create'.$this->name(),
285 285
             [
286 286
                 'inputFields'         => $inputFields,
287 287
                 'outputFields'        => [
Please login to merge, or discard this patch.
core/domain/services/graphql/types/Country.php 1 patch
Indentation   +103 added lines, -103 removed lines patch added patch discarded remove patch
@@ -18,109 +18,109 @@
 block discarded – undo
18 18
 class Country extends TypeBase
19 19
 {
20 20
 
21
-    /**
22
-     * Country constructor.
23
-     *
24
-     * @param EEM_Country $country_model
25
-     */
26
-    public function __construct(EEM_Country $country_model)
27
-    {
28
-        $this->model = $country_model;
29
-        $this->setName('Country');
30
-        $this->setDescription(__('A country', 'event_espresso'));
31
-        $this->setIsCustomPostType(false);
32
-        parent::__construct();
33
-    }
21
+	/**
22
+	 * Country constructor.
23
+	 *
24
+	 * @param EEM_Country $country_model
25
+	 */
26
+	public function __construct(EEM_Country $country_model)
27
+	{
28
+		$this->model = $country_model;
29
+		$this->setName('Country');
30
+		$this->setDescription(__('A country', 'event_espresso'));
31
+		$this->setIsCustomPostType(false);
32
+		parent::__construct();
33
+	}
34 34
 
35 35
 
36
-    /**
37
-     * @return GraphQLFieldInterface[]
38
-     * @since $VID:$
39
-     */
40
-    public function getFields()
41
-    {
42
-        return [
43
-            new GraphQLField(
44
-                'id',
45
-                ['non_null' => 'ID'],
46
-                null,
47
-                esc_html__('The globally unique ID for the object.', 'event_espresso')
48
-            ),
49
-            new GraphQLField(
50
-                'isActive',
51
-                'Boolean',
52
-                null, // 'active',
53
-                esc_html__(
54
-                    'Flag that indicates if the country should appear in dropdown select lists',
55
-                    'event_espresso'
56
-                )
57
-            ),
58
-            new GraphQLField(
59
-                'ISO',
60
-                'String',
61
-                null, // 'ISO',
62
-                esc_html__('Country ISO Code', 'event_espresso')
63
-            ),
64
-            new GraphQLField(
65
-                'ISO3',
66
-                'String',
67
-                null, // 'ISO3',
68
-                esc_html__('Country ISO3 Code', 'event_espresso')
69
-            ),
70
-            new GraphQLField(
71
-                'name',
72
-                'String',
73
-                'name',
74
-                esc_html__('Country Name', 'event_espresso')
75
-            ),
76
-            new GraphQLField(
77
-                'currencyCode',
78
-                'String',
79
-                'currency_code',
80
-                esc_html__('Country Currency Code', 'event_espresso')
81
-            ),
82
-            new GraphQLField(
83
-                'currencySingular',
84
-                'String',
85
-                'currency_name_single',
86
-                esc_html__('Currency Name Singular', 'event_espresso')
87
-            ),
88
-            new GraphQLField(
89
-                'currencyPlural',
90
-                'String',
91
-                'currency_name_plural',
92
-                esc_html__('Currency Name Plural', 'event_espresso')
93
-            ),
94
-            new GraphQLField(
95
-                'currencySign',
96
-                'String',
97
-                'currency_sign',
98
-                __('Currency Sign', 'event_espresso')
99
-            ),
100
-            new GraphQLField(
101
-                'currencySignBeforeNumber',
102
-                'String',
103
-                'currency_sign_before',
104
-                esc_html__('Currency Sign Before Number', 'event_espresso')
105
-            ),
106
-            new GraphQLField(
107
-                'currencyDecimalPlaces',
108
-                'String',
109
-                'currency_decimal_places',
110
-                esc_html__('Currency Decimal Places', 'event_espresso')
111
-            ),
112
-            new GraphQLField(
113
-                'currencyDecimalMark',
114
-                'String',
115
-                'currency_decimal_mark',
116
-                esc_html__('Currency Decimal Mark', 'event_espresso')
117
-            ),
118
-            new GraphQLField(
119
-                'currencyThousandsSeparator',
120
-                'String',
121
-                'currency_thousands_separator',
122
-                esc_html__('Currency Thousands Separator', 'event_espresso')
123
-            ),
124
-        ];
125
-    }
36
+	/**
37
+	 * @return GraphQLFieldInterface[]
38
+	 * @since $VID:$
39
+	 */
40
+	public function getFields()
41
+	{
42
+		return [
43
+			new GraphQLField(
44
+				'id',
45
+				['non_null' => 'ID'],
46
+				null,
47
+				esc_html__('The globally unique ID for the object.', 'event_espresso')
48
+			),
49
+			new GraphQLField(
50
+				'isActive',
51
+				'Boolean',
52
+				null, // 'active',
53
+				esc_html__(
54
+					'Flag that indicates if the country should appear in dropdown select lists',
55
+					'event_espresso'
56
+				)
57
+			),
58
+			new GraphQLField(
59
+				'ISO',
60
+				'String',
61
+				null, // 'ISO',
62
+				esc_html__('Country ISO Code', 'event_espresso')
63
+			),
64
+			new GraphQLField(
65
+				'ISO3',
66
+				'String',
67
+				null, // 'ISO3',
68
+				esc_html__('Country ISO3 Code', 'event_espresso')
69
+			),
70
+			new GraphQLField(
71
+				'name',
72
+				'String',
73
+				'name',
74
+				esc_html__('Country Name', 'event_espresso')
75
+			),
76
+			new GraphQLField(
77
+				'currencyCode',
78
+				'String',
79
+				'currency_code',
80
+				esc_html__('Country Currency Code', 'event_espresso')
81
+			),
82
+			new GraphQLField(
83
+				'currencySingular',
84
+				'String',
85
+				'currency_name_single',
86
+				esc_html__('Currency Name Singular', 'event_espresso')
87
+			),
88
+			new GraphQLField(
89
+				'currencyPlural',
90
+				'String',
91
+				'currency_name_plural',
92
+				esc_html__('Currency Name Plural', 'event_espresso')
93
+			),
94
+			new GraphQLField(
95
+				'currencySign',
96
+				'String',
97
+				'currency_sign',
98
+				__('Currency Sign', 'event_espresso')
99
+			),
100
+			new GraphQLField(
101
+				'currencySignBeforeNumber',
102
+				'String',
103
+				'currency_sign_before',
104
+				esc_html__('Currency Sign Before Number', 'event_espresso')
105
+			),
106
+			new GraphQLField(
107
+				'currencyDecimalPlaces',
108
+				'String',
109
+				'currency_decimal_places',
110
+				esc_html__('Currency Decimal Places', 'event_espresso')
111
+			),
112
+			new GraphQLField(
113
+				'currencyDecimalMark',
114
+				'String',
115
+				'currency_decimal_mark',
116
+				esc_html__('Currency Decimal Mark', 'event_espresso')
117
+			),
118
+			new GraphQLField(
119
+				'currencyThousandsSeparator',
120
+				'String',
121
+				'currency_thousands_separator',
122
+				esc_html__('Currency Thousands Separator', 'event_espresso')
123
+			),
124
+		];
125
+	}
126 126
 }
Please login to merge, or discard this patch.
core/domain/services/graphql/types/Datetime.php 2 patches
Indentation   +249 added lines, -249 removed lines patch added patch discarded remove patch
@@ -25,259 +25,259 @@
 block discarded – undo
25 25
 class Datetime extends TypeBase
26 26
 {
27 27
 
28
-    /**
29
-     * EventDate constructor.
30
-     *
31
-     * @param EEM_Datetime $datetime_model
32
-     */
33
-    public function __construct(EEM_Datetime $datetime_model)
34
-    {
35
-        $this->model = $datetime_model;
36
-        $this->setName('Datetime');
37
-        $this->setDescription(__('An event date', 'event_espresso'));
38
-        $this->setIsCustomPostType(false);
39
-        parent::__construct();
40
-    }
28
+	/**
29
+	 * EventDate constructor.
30
+	 *
31
+	 * @param EEM_Datetime $datetime_model
32
+	 */
33
+	public function __construct(EEM_Datetime $datetime_model)
34
+	{
35
+		$this->model = $datetime_model;
36
+		$this->setName('Datetime');
37
+		$this->setDescription(__('An event date', 'event_espresso'));
38
+		$this->setIsCustomPostType(false);
39
+		parent::__construct();
40
+	}
41 41
 
42 42
 
43
-    /**
44
-     * @return GraphQLFieldInterface[]
45
-     * @since $VID:$
46
-     */
47
-    public function getFields()
48
-    {
49
-        return [
50
-            new GraphQLField(
51
-                'id',
52
-                ['non_null' => 'ID'],
53
-                null,
54
-                esc_html__('The globally unique ID for the object.', 'event_espresso')
55
-            ),
56
-            new GraphQLOutputField(
57
-                lcfirst($this->name()) . 'Id',
58
-                ['non_null' => 'Int'],
59
-                'ID',
60
-                esc_html__('The datetime ID.', 'event_espresso')
61
-            ),
62
-            new GraphQLField(
63
-                'name',
64
-                'String',
65
-                'name',
66
-                esc_html__('Datetime Name', 'event_espresso')
67
-            ),
68
-            new GraphQLField(
69
-                'description',
70
-                'String',
71
-                'description',
72
-                esc_html__('Description for Datetime', 'event_espresso')
73
-            ),
74
-            new GraphQLField(
75
-                'start',
76
-                'String',
77
-                'start',
78
-                esc_html__('Start timestamp of Event', 'event_espresso')
79
-            ),
80
-            new GraphQLField(
81
-                'startDate',
82
-                'String',
83
-                'start_date',
84
-                esc_html__('Start time/date of Event', 'event_espresso')
85
-            ),
86
-            new GraphQLField(
87
-                'end',
88
-                'String',
89
-                'end',
90
-                esc_html__('End timestamp of Event', 'event_espresso')
91
-            ),
92
-            new GraphQLField(
93
-                'endDate',
94
-                'String',
95
-                'end_date',
96
-                esc_html__('End time/date of Event', 'event_espresso')
97
-            ),
98
-            new GraphQLField(
99
-                'startTime',
100
-                'String',
101
-                'start_time',
102
-                esc_html__('Start time of Event', 'event_espresso')
103
-            ),
104
-            new GraphQLField(
105
-                'endTime',
106
-                'String',
107
-                'end_time',
108
-                esc_html__('End time of Event', 'event_espresso')
109
-            ),
110
-            new GraphQLField(
111
-                'capacity',
112
-                'Int',
113
-                'reg_limit',
114
-                esc_html__('Registration Limit for this time', 'event_espresso'),
115
-                [$this, 'parseInfiniteValue']
116
-            ),
117
-            new GraphQLField(
118
-                'sold',
119
-                'Int',
120
-                'sold',
121
-                esc_html__('How many sales for this Datetime that have occurred', 'event_espresso')
122
-            ),
123
-            new GraphQLField(
124
-                'reserved',
125
-                'Int',
126
-                'reserved',
127
-                esc_html__('Quantity of tickets reserved, but not yet fully purchased', 'event_espresso')
128
-            ),
129
-            new GraphQLField(
130
-                'order',
131
-                'Int',
132
-                'order',
133
-                esc_html__('The order in which the Datetime is displayed', 'event_espresso')
134
-            ),
135
-            new GraphQLField(
136
-                'length',
137
-                'Int',
138
-                'length',
139
-                esc_html__('The length of the event (start to end time) in seconds', 'event_espresso')
140
-            ),
141
-            new GraphQLOutputField(
142
-                'parent',
143
-                'Datetime',
144
-                null,
145
-                esc_html__('The parent datetime of the current datetime', 'event_espresso')
146
-            ),
147
-            new GraphQLInputField(
148
-                'parent',
149
-                'Int',
150
-                null,
151
-                esc_html__('The parent datetime ID', 'event_espresso')
152
-            ),
153
-            new GraphQLField(
154
-                'isPrimary',
155
-                'Boolean',
156
-                'is_primary',
157
-                esc_html__('Flag indicating datetime is primary one for event', 'event_espresso')
158
-            ),
159
-            new GraphQLField(
160
-                'isSoldOut',
161
-                'Boolean',
162
-                'sold_out',
163
-                esc_html__(
164
-                    'Flag indicating whether the tickets sold for this datetime, met or exceed the registration limit',
165
-                    'event_espresso'
166
-                )
167
-            ),
168
-            new GraphQLField(
169
-                'isUpcoming',
170
-                'Boolean',
171
-                'is_upcoming',
172
-                esc_html__('Whether the date is upcoming', 'event_espresso')
173
-            ),
174
-            new GraphQLField(
175
-                'isActive',
176
-                'Boolean',
177
-                'is_active',
178
-                esc_html__('Flag indicating datetime is active', 'event_espresso')
179
-            ),
180
-            new GraphQLField(
181
-                'isExpired',
182
-                'Boolean',
183
-                'is_expired',
184
-                esc_html__('Flag indicating datetime is expired or not', 'event_espresso')
185
-            ),
186
-            new GraphQLOutputField(
187
-                'event',
188
-                'Event',
189
-                null,
190
-                esc_html__('Event of the datetime.', 'event_espresso')
191
-            ),
192
-            new GraphQLInputField(
193
-                'eventId',
194
-                'Int',
195
-                null,
196
-                esc_html__('Event ID of the datetime.', 'event_espresso')
197
-            ),
198
-            new GraphQLInputField(
199
-                'event',
200
-                'ID',
201
-                null,
202
-                esc_html__('Globally uqinue event ID of the datetime.', 'event_espresso')
203
-            ),
204
-            new GraphQLInputField(
205
-                'tickets',
206
-                ['list_of' => 'ID'],
207
-                null,
208
-                sprintf(
209
-                    '%1$s %2$s',
210
-                    esc_html__('Globally uqinue IDs of the tickets related to the datetime.', 'event_espresso'),
211
-                    esc_html__('Ignored if empty.', 'event_espresso')
212
-                )
213
-            ),
214
-        ];
215
-    }
43
+	/**
44
+	 * @return GraphQLFieldInterface[]
45
+	 * @since $VID:$
46
+	 */
47
+	public function getFields()
48
+	{
49
+		return [
50
+			new GraphQLField(
51
+				'id',
52
+				['non_null' => 'ID'],
53
+				null,
54
+				esc_html__('The globally unique ID for the object.', 'event_espresso')
55
+			),
56
+			new GraphQLOutputField(
57
+				lcfirst($this->name()) . 'Id',
58
+				['non_null' => 'Int'],
59
+				'ID',
60
+				esc_html__('The datetime ID.', 'event_espresso')
61
+			),
62
+			new GraphQLField(
63
+				'name',
64
+				'String',
65
+				'name',
66
+				esc_html__('Datetime Name', 'event_espresso')
67
+			),
68
+			new GraphQLField(
69
+				'description',
70
+				'String',
71
+				'description',
72
+				esc_html__('Description for Datetime', 'event_espresso')
73
+			),
74
+			new GraphQLField(
75
+				'start',
76
+				'String',
77
+				'start',
78
+				esc_html__('Start timestamp of Event', 'event_espresso')
79
+			),
80
+			new GraphQLField(
81
+				'startDate',
82
+				'String',
83
+				'start_date',
84
+				esc_html__('Start time/date of Event', 'event_espresso')
85
+			),
86
+			new GraphQLField(
87
+				'end',
88
+				'String',
89
+				'end',
90
+				esc_html__('End timestamp of Event', 'event_espresso')
91
+			),
92
+			new GraphQLField(
93
+				'endDate',
94
+				'String',
95
+				'end_date',
96
+				esc_html__('End time/date of Event', 'event_espresso')
97
+			),
98
+			new GraphQLField(
99
+				'startTime',
100
+				'String',
101
+				'start_time',
102
+				esc_html__('Start time of Event', 'event_espresso')
103
+			),
104
+			new GraphQLField(
105
+				'endTime',
106
+				'String',
107
+				'end_time',
108
+				esc_html__('End time of Event', 'event_espresso')
109
+			),
110
+			new GraphQLField(
111
+				'capacity',
112
+				'Int',
113
+				'reg_limit',
114
+				esc_html__('Registration Limit for this time', 'event_espresso'),
115
+				[$this, 'parseInfiniteValue']
116
+			),
117
+			new GraphQLField(
118
+				'sold',
119
+				'Int',
120
+				'sold',
121
+				esc_html__('How many sales for this Datetime that have occurred', 'event_espresso')
122
+			),
123
+			new GraphQLField(
124
+				'reserved',
125
+				'Int',
126
+				'reserved',
127
+				esc_html__('Quantity of tickets reserved, but not yet fully purchased', 'event_espresso')
128
+			),
129
+			new GraphQLField(
130
+				'order',
131
+				'Int',
132
+				'order',
133
+				esc_html__('The order in which the Datetime is displayed', 'event_espresso')
134
+			),
135
+			new GraphQLField(
136
+				'length',
137
+				'Int',
138
+				'length',
139
+				esc_html__('The length of the event (start to end time) in seconds', 'event_espresso')
140
+			),
141
+			new GraphQLOutputField(
142
+				'parent',
143
+				'Datetime',
144
+				null,
145
+				esc_html__('The parent datetime of the current datetime', 'event_espresso')
146
+			),
147
+			new GraphQLInputField(
148
+				'parent',
149
+				'Int',
150
+				null,
151
+				esc_html__('The parent datetime ID', 'event_espresso')
152
+			),
153
+			new GraphQLField(
154
+				'isPrimary',
155
+				'Boolean',
156
+				'is_primary',
157
+				esc_html__('Flag indicating datetime is primary one for event', 'event_espresso')
158
+			),
159
+			new GraphQLField(
160
+				'isSoldOut',
161
+				'Boolean',
162
+				'sold_out',
163
+				esc_html__(
164
+					'Flag indicating whether the tickets sold for this datetime, met or exceed the registration limit',
165
+					'event_espresso'
166
+				)
167
+			),
168
+			new GraphQLField(
169
+				'isUpcoming',
170
+				'Boolean',
171
+				'is_upcoming',
172
+				esc_html__('Whether the date is upcoming', 'event_espresso')
173
+			),
174
+			new GraphQLField(
175
+				'isActive',
176
+				'Boolean',
177
+				'is_active',
178
+				esc_html__('Flag indicating datetime is active', 'event_espresso')
179
+			),
180
+			new GraphQLField(
181
+				'isExpired',
182
+				'Boolean',
183
+				'is_expired',
184
+				esc_html__('Flag indicating datetime is expired or not', 'event_espresso')
185
+			),
186
+			new GraphQLOutputField(
187
+				'event',
188
+				'Event',
189
+				null,
190
+				esc_html__('Event of the datetime.', 'event_espresso')
191
+			),
192
+			new GraphQLInputField(
193
+				'eventId',
194
+				'Int',
195
+				null,
196
+				esc_html__('Event ID of the datetime.', 'event_espresso')
197
+			),
198
+			new GraphQLInputField(
199
+				'event',
200
+				'ID',
201
+				null,
202
+				esc_html__('Globally uqinue event ID of the datetime.', 'event_espresso')
203
+			),
204
+			new GraphQLInputField(
205
+				'tickets',
206
+				['list_of' => 'ID'],
207
+				null,
208
+				sprintf(
209
+					'%1$s %2$s',
210
+					esc_html__('Globally uqinue IDs of the tickets related to the datetime.', 'event_espresso'),
211
+					esc_html__('Ignored if empty.', 'event_espresso')
212
+				)
213
+			),
214
+		];
215
+	}
216 216
 
217 217
 
218
-    /**
219
-     * @param array $inputFields The mutation input fields.
220
-     * @throws InvalidArgumentException
221
-     * @throws ReflectionException
222
-     * @since $VID:$
223
-     */
224
-    public function registerMutations(array $inputFields)
225
-    {
226
-        // Register mutation to update an entity.
227
-        register_graphql_mutation(
228
-            'update' . $this->name(),
229
-            [
230
-                'inputFields'         => $inputFields,
231
-                'outputFields'        => [
232
-                    lcfirst($this->name()) => [
233
-                        'type'    => $this->name(),
234
-                        'resolve' => [$this, 'resolveFromPayload'],
235
-                    ],
236
-                ],
237
-                'mutateAndGetPayload' => DatetimeUpdate::mutateAndGetPayload($this->model, $this),
238
-            ]
239
-        );
240
-        // Register mutation to delete an entity.
241
-        register_graphql_mutation(
242
-            'delete' . $this->name(),
243
-            [
244
-                'inputFields'         => [
245
-                    'id'                => $inputFields['id'],
246
-                    'deletePermanently' => [
247
-                        'type'        => 'Boolean',
248
-                        'description' => esc_html__('Whether to delete the entity permanently.', 'event_espresso'),
249
-                    ],
250
-                ],
251
-                'outputFields'        => [
252
-                    lcfirst($this->name()) => [
253
-                        'type'        => $this->name(),
254
-                        'description' => esc_html__('The object before it was deleted', 'event_espresso'),
255
-                        'resolve'     => static function ($payload) {
256
-                            $deleted = (object) $payload['deleted'];
218
+	/**
219
+	 * @param array $inputFields The mutation input fields.
220
+	 * @throws InvalidArgumentException
221
+	 * @throws ReflectionException
222
+	 * @since $VID:$
223
+	 */
224
+	public function registerMutations(array $inputFields)
225
+	{
226
+		// Register mutation to update an entity.
227
+		register_graphql_mutation(
228
+			'update' . $this->name(),
229
+			[
230
+				'inputFields'         => $inputFields,
231
+				'outputFields'        => [
232
+					lcfirst($this->name()) => [
233
+						'type'    => $this->name(),
234
+						'resolve' => [$this, 'resolveFromPayload'],
235
+					],
236
+				],
237
+				'mutateAndGetPayload' => DatetimeUpdate::mutateAndGetPayload($this->model, $this),
238
+			]
239
+		);
240
+		// Register mutation to delete an entity.
241
+		register_graphql_mutation(
242
+			'delete' . $this->name(),
243
+			[
244
+				'inputFields'         => [
245
+					'id'                => $inputFields['id'],
246
+					'deletePermanently' => [
247
+						'type'        => 'Boolean',
248
+						'description' => esc_html__('Whether to delete the entity permanently.', 'event_espresso'),
249
+					],
250
+				],
251
+				'outputFields'        => [
252
+					lcfirst($this->name()) => [
253
+						'type'        => $this->name(),
254
+						'description' => esc_html__('The object before it was deleted', 'event_espresso'),
255
+						'resolve'     => static function ($payload) {
256
+							$deleted = (object) $payload['deleted'];
257 257
 
258
-                            return ! empty($deleted) ? $deleted : null;
259
-                        },
260
-                    ],
261
-                ],
262
-                'mutateAndGetPayload' => DatetimeDelete::mutateAndGetPayload($this->model, $this),
263
-            ]
264
-        );
258
+							return ! empty($deleted) ? $deleted : null;
259
+						},
260
+					],
261
+				],
262
+				'mutateAndGetPayload' => DatetimeDelete::mutateAndGetPayload($this->model, $this),
263
+			]
264
+		);
265 265
 
266
-        // remove primary key from input.
267
-        unset($inputFields['id']);
268
-        // Register mutation to update an entity.
269
-        register_graphql_mutation(
270
-            'create' . $this->name(),
271
-            [
272
-                'inputFields'         => $inputFields,
273
-                'outputFields'        => [
274
-                    lcfirst($this->name()) => [
275
-                        'type'    => $this->name(),
276
-                        'resolve' => [$this, 'resolveFromPayload'],
277
-                    ],
278
-                ],
279
-                'mutateAndGetPayload' => DatetimeCreate::mutateAndGetPayload($this->model, $this),
280
-            ]
281
-        );
282
-    }
266
+		// remove primary key from input.
267
+		unset($inputFields['id']);
268
+		// Register mutation to update an entity.
269
+		register_graphql_mutation(
270
+			'create' . $this->name(),
271
+			[
272
+				'inputFields'         => $inputFields,
273
+				'outputFields'        => [
274
+					lcfirst($this->name()) => [
275
+						'type'    => $this->name(),
276
+						'resolve' => [$this, 'resolveFromPayload'],
277
+					],
278
+				],
279
+				'mutateAndGetPayload' => DatetimeCreate::mutateAndGetPayload($this->model, $this),
280
+			]
281
+		);
282
+	}
283 283
 }
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
                 esc_html__('The globally unique ID for the object.', 'event_espresso')
55 55
             ),
56 56
             new GraphQLOutputField(
57
-                lcfirst($this->name()) . 'Id',
57
+                lcfirst($this->name()).'Id',
58 58
                 ['non_null' => 'Int'],
59 59
                 'ID',
60 60
                 esc_html__('The datetime ID.', 'event_espresso')
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
     {
226 226
         // Register mutation to update an entity.
227 227
         register_graphql_mutation(
228
-            'update' . $this->name(),
228
+            'update'.$this->name(),
229 229
             [
230 230
                 'inputFields'         => $inputFields,
231 231
                 'outputFields'        => [
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
         );
240 240
         // Register mutation to delete an entity.
241 241
         register_graphql_mutation(
242
-            'delete' . $this->name(),
242
+            'delete'.$this->name(),
243 243
             [
244 244
                 'inputFields'         => [
245 245
                     'id'                => $inputFields['id'],
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
                     lcfirst($this->name()) => [
253 253
                         'type'        => $this->name(),
254 254
                         'description' => esc_html__('The object before it was deleted', 'event_espresso'),
255
-                        'resolve'     => static function ($payload) {
255
+                        'resolve'     => static function($payload) {
256 256
                             $deleted = (object) $payload['deleted'];
257 257
 
258 258
                             return ! empty($deleted) ? $deleted : null;
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
         unset($inputFields['id']);
268 268
         // Register mutation to update an entity.
269 269
         register_graphql_mutation(
270
-            'create' . $this->name(),
270
+            'create'.$this->name(),
271 271
             [
272 272
                 'inputFields'         => $inputFields,
273 273
                 'outputFields'        => [
Please login to merge, or discard this patch.
core/domain/services/graphql/mutators/TicketDelete.php 1 patch
Indentation   +64 added lines, -64 removed lines patch added patch discarded remove patch
@@ -20,74 +20,74 @@
 block discarded – undo
20 20
 class TicketDelete
21 21
 {
22 22
 
23
-    /**
24
-     * Defines the mutation data modification closure.
25
-     *
26
-     * @param EEM_Ticket $model
27
-     * @param Ticket     $type
28
-     * @return callable
29
-     */
30
-    public static function mutateAndGetPayload(EEM_Ticket $model, Ticket $type)
31
-    {
32
-        /**
33
-         * Deletes an entity.
34
-         *
35
-         * @param array       $input   The input for the mutation
36
-         * @param AppContext  $context The AppContext passed down to all resolvers
37
-         * @param ResolveInfo $info    The ResolveInfo passed down to all resolvers
38
-         * @return array
39
-         * @throws UserError
40
-         * @throws ReflectionException
41
-         * @throws InvalidArgumentException
42
-         * @throws InvalidInterfaceException
43
-         * @throws InvalidDataTypeException
44
-         * @throws EE_Error
45
-         */
46
-        return static function ($input, AppContext $context, ResolveInfo $info) use ($model, $type) {
47
-            /**
48
-             * Stop now if a user isn't allowed to create a datetime.
49
-             */
50
-            if (! current_user_can('ee_edit_events')) {
51
-                // translators: the %1$s is the name of the object being mutated
52
-                throw new UserError(
53
-                    sprintf(
54
-                        __('Sorry, you are not allowed to edit %1$s', 'event_espresso'),
55
-                        $type->name()
56
-                    )
57
-                );
58
-            }
59
-            $id_parts = ! empty($input['id']) ? Relay::fromGlobalId($input['id']) : null;
23
+	/**
24
+	 * Defines the mutation data modification closure.
25
+	 *
26
+	 * @param EEM_Ticket $model
27
+	 * @param Ticket     $type
28
+	 * @return callable
29
+	 */
30
+	public static function mutateAndGetPayload(EEM_Ticket $model, Ticket $type)
31
+	{
32
+		/**
33
+		 * Deletes an entity.
34
+		 *
35
+		 * @param array       $input   The input for the mutation
36
+		 * @param AppContext  $context The AppContext passed down to all resolvers
37
+		 * @param ResolveInfo $info    The ResolveInfo passed down to all resolvers
38
+		 * @return array
39
+		 * @throws UserError
40
+		 * @throws ReflectionException
41
+		 * @throws InvalidArgumentException
42
+		 * @throws InvalidInterfaceException
43
+		 * @throws InvalidDataTypeException
44
+		 * @throws EE_Error
45
+		 */
46
+		return static function ($input, AppContext $context, ResolveInfo $info) use ($model, $type) {
47
+			/**
48
+			 * Stop now if a user isn't allowed to create a datetime.
49
+			 */
50
+			if (! current_user_can('ee_edit_events')) {
51
+				// translators: the %1$s is the name of the object being mutated
52
+				throw new UserError(
53
+					sprintf(
54
+						__('Sorry, you are not allowed to edit %1$s', 'event_espresso'),
55
+						$type->name()
56
+					)
57
+				);
58
+			}
59
+			$id_parts = ! empty($input['id']) ? Relay::fromGlobalId($input['id']) : null;
60 60
 
61
-            $id = ! empty($id_parts['id']) && is_int($id_parts['id']) ? $id_parts['id'] : 0;
62
-            $entity = null;
61
+			$id = ! empty($id_parts['id']) && is_int($id_parts['id']) ? $id_parts['id'] : 0;
62
+			$entity = null;
63 63
 
64
-            if ($id) {
65
-                $entity = $model->get_one_by_ID($id);
66
-            }
64
+			if ($id) {
65
+				$entity = $model->get_one_by_ID($id);
66
+			}
67 67
 
68
-            /**
69
-             * If there's no existing datetime, throw an exception
70
-             */
71
-            if (! $id || ! ($entity instanceof EE_Ticket)) {
72
-                // translators: the placeholder is the name of the type being updated
73
-                throw new UserError(
74
-                    sprintf(
75
-                        __('No %1$s could be found to delete', 'event_espresso'),
76
-                        $type->name()
77
-                    )
78
-                );
79
-            }
68
+			/**
69
+			 * If there's no existing datetime, throw an exception
70
+			 */
71
+			if (! $id || ! ($entity instanceof EE_Ticket)) {
72
+				// translators: the placeholder is the name of the type being updated
73
+				throw new UserError(
74
+					sprintf(
75
+						__('No %1$s could be found to delete', 'event_espresso'),
76
+						$type->name()
77
+					)
78
+				);
79
+			}
80 80
 
81
-            // Delete the entity
82
-            $result = ! empty($input['deletePermanently']) ? $entity->delete_permanently() : $entity->delete();
81
+			// Delete the entity
82
+			$result = ! empty($input['deletePermanently']) ? $entity->delete_permanently() : $entity->delete();
83 83
 
84
-            if (empty($result)) {
85
-                throw new UserError(__('The object failed to delete but no error was provided', 'event_espresso'));
86
-            }
84
+			if (empty($result)) {
85
+				throw new UserError(__('The object failed to delete but no error was provided', 'event_espresso'));
86
+			}
87 87
 
88
-            return [
89
-                'deleted' => $entity,
90
-            ];
91
-        };
92
-    }
88
+			return [
89
+				'deleted' => $entity,
90
+			];
91
+		};
92
+	}
93 93
 }
Please login to merge, or discard this patch.
core/domain/services/graphql/mutators/DatetimeUpdate.php 1 patch
Indentation   +77 added lines, -77 removed lines patch added patch discarded remove patch
@@ -21,81 +21,81 @@
 block discarded – undo
21 21
 class DatetimeUpdate
22 22
 {
23 23
 
24
-    /**
25
-     * Defines the mutation data modification closure.
26
-     *
27
-     * @param EEM_Datetime $model
28
-     * @param Datetime     $type
29
-     * @return callable
30
-     */
31
-    public static function mutateAndGetPayload(EEM_Datetime $model, Datetime $type)
32
-    {
33
-        /**
34
-         * Updates an entity.
35
-         *
36
-         * @param array       $input   The input for the mutation
37
-         * @param AppContext  $context The AppContext passed down to all resolvers
38
-         * @param ResolveInfo $info    The ResolveInfo passed down to all resolvers
39
-         * @return array
40
-         * @throws UserError
41
-         * @throws ReflectionException
42
-         * @throws InvalidArgumentException
43
-         * @throws InvalidInterfaceException
44
-         * @throws InvalidDataTypeException
45
-         * @throws EE_Error
46
-         */
47
-        return static function ($input, AppContext $context, ResolveInfo $info) use ($model, $type) {
48
-            /**
49
-             * Stop now if a user isn't allowed to create a datetime.
50
-             */
51
-            if (! current_user_can('ee_edit_events')) {
52
-                // translators: the %1$s is the name of the object being mutated
53
-                throw new UserError(
54
-                    sprintf(__('Sorry, you are not allowed to edit %1$s', 'event_espresso'), $type->name())
55
-                );
56
-            }
57
-            $id_parts = ! empty($input['id']) ? Relay::fromGlobalId($input['id']) : null;
58
-
59
-            $id = ! empty($id_parts['id']) && is_int($id_parts['id']) ? $id_parts['id'] : 0;
60
-            $entity = null;
61
-
62
-            if ($id) {
63
-                $entity = $model->get_one_by_ID($id);
64
-            }
65
-
66
-            /**
67
-             * If there's no existing datetime, throw an exception
68
-             */
69
-            if (! $id || ! ($entity instanceof EE_Datetime)) {
70
-                // translators: the placeholder is the name of the type being updated
71
-                throw new UserError(
72
-                    sprintf(__('No %1$s could be found to update', 'event_espresso'), $type->name())
73
-                );
74
-            }
75
-
76
-            $tickets = [];
77
-
78
-            $args = DatetimeMutation::prepareFields($input);
79
-
80
-            if (isset($args['tickets'])) {
81
-                $tickets = $args['tickets'];
82
-                unset($args['tickets']);
83
-            }
84
-
85
-            // Update the entity
86
-            $result = $entity->save($args);
87
-
88
-            if (empty($result)) {
89
-                throw new UserError(__('The object failed to update but no error was provided', 'event_espresso'));
90
-            }
91
-
92
-            if (! empty($tickets)) {
93
-                DatetimeMutation::setRelatedTickets($entity, $tickets);
94
-            }
95
-
96
-            return [
97
-                'id' => $id,
98
-            ];
99
-        };
100
-    }
24
+	/**
25
+	 * Defines the mutation data modification closure.
26
+	 *
27
+	 * @param EEM_Datetime $model
28
+	 * @param Datetime     $type
29
+	 * @return callable
30
+	 */
31
+	public static function mutateAndGetPayload(EEM_Datetime $model, Datetime $type)
32
+	{
33
+		/**
34
+		 * Updates an entity.
35
+		 *
36
+		 * @param array       $input   The input for the mutation
37
+		 * @param AppContext  $context The AppContext passed down to all resolvers
38
+		 * @param ResolveInfo $info    The ResolveInfo passed down to all resolvers
39
+		 * @return array
40
+		 * @throws UserError
41
+		 * @throws ReflectionException
42
+		 * @throws InvalidArgumentException
43
+		 * @throws InvalidInterfaceException
44
+		 * @throws InvalidDataTypeException
45
+		 * @throws EE_Error
46
+		 */
47
+		return static function ($input, AppContext $context, ResolveInfo $info) use ($model, $type) {
48
+			/**
49
+			 * Stop now if a user isn't allowed to create a datetime.
50
+			 */
51
+			if (! current_user_can('ee_edit_events')) {
52
+				// translators: the %1$s is the name of the object being mutated
53
+				throw new UserError(
54
+					sprintf(__('Sorry, you are not allowed to edit %1$s', 'event_espresso'), $type->name())
55
+				);
56
+			}
57
+			$id_parts = ! empty($input['id']) ? Relay::fromGlobalId($input['id']) : null;
58
+
59
+			$id = ! empty($id_parts['id']) && is_int($id_parts['id']) ? $id_parts['id'] : 0;
60
+			$entity = null;
61
+
62
+			if ($id) {
63
+				$entity = $model->get_one_by_ID($id);
64
+			}
65
+
66
+			/**
67
+			 * If there's no existing datetime, throw an exception
68
+			 */
69
+			if (! $id || ! ($entity instanceof EE_Datetime)) {
70
+				// translators: the placeholder is the name of the type being updated
71
+				throw new UserError(
72
+					sprintf(__('No %1$s could be found to update', 'event_espresso'), $type->name())
73
+				);
74
+			}
75
+
76
+			$tickets = [];
77
+
78
+			$args = DatetimeMutation::prepareFields($input);
79
+
80
+			if (isset($args['tickets'])) {
81
+				$tickets = $args['tickets'];
82
+				unset($args['tickets']);
83
+			}
84
+
85
+			// Update the entity
86
+			$result = $entity->save($args);
87
+
88
+			if (empty($result)) {
89
+				throw new UserError(__('The object failed to update but no error was provided', 'event_espresso'));
90
+			}
91
+
92
+			if (! empty($tickets)) {
93
+				DatetimeMutation::setRelatedTickets($entity, $tickets);
94
+			}
95
+
96
+			return [
97
+				'id' => $id,
98
+			];
99
+		};
100
+	}
101 101
 }
Please login to merge, or discard this patch.
core/domain/services/graphql/mutators/DatetimeDelete.php 1 patch
Indentation   +58 added lines, -58 removed lines patch added patch discarded remove patch
@@ -20,68 +20,68 @@
 block discarded – undo
20 20
 class DatetimeDelete
21 21
 {
22 22
 
23
-    /**
24
-     * Defines the mutation data modification closure.
25
-     *
26
-     * @param EEM_Datetime $model
27
-     * @param Datetime     $type
28
-     * @return callable
29
-     */
30
-    public static function mutateAndGetPayload(EEM_Datetime $model, Datetime $type)
31
-    {
32
-        /**
33
-         * Deletes an entity.
34
-         *
35
-         * @param array       $input   The input for the mutation
36
-         * @param AppContext  $context The AppContext passed down to all resolvers
37
-         * @param ResolveInfo $info    The ResolveInfo passed down to all resolvers
38
-         * @return array
39
-         * @throws UserError
40
-         * @throws ReflectionException
41
-         * @throws InvalidArgumentException
42
-         * @throws InvalidInterfaceException
43
-         * @throws InvalidDataTypeException
44
-         * @throws EE_Error
45
-         */
46
-        return static function ($input, AppContext $context, ResolveInfo $info) use ($model, $type) {
47
-            /**
48
-             * Stop now if a user isn't allowed to create a datetime.
49
-             */
50
-            if (! current_user_can('ee_edit_events')) {
51
-                // translators: the %1$s is the name of the object being mutated
52
-                throw new UserError(
53
-                    sprintf(__('Sorry, you are not allowed to edit %1$s', 'event_espresso'), $type->name())
54
-                );
55
-            }
56
-            $id_parts = ! empty($input['id']) ? Relay::fromGlobalId($input['id']) : null;
23
+	/**
24
+	 * Defines the mutation data modification closure.
25
+	 *
26
+	 * @param EEM_Datetime $model
27
+	 * @param Datetime     $type
28
+	 * @return callable
29
+	 */
30
+	public static function mutateAndGetPayload(EEM_Datetime $model, Datetime $type)
31
+	{
32
+		/**
33
+		 * Deletes an entity.
34
+		 *
35
+		 * @param array       $input   The input for the mutation
36
+		 * @param AppContext  $context The AppContext passed down to all resolvers
37
+		 * @param ResolveInfo $info    The ResolveInfo passed down to all resolvers
38
+		 * @return array
39
+		 * @throws UserError
40
+		 * @throws ReflectionException
41
+		 * @throws InvalidArgumentException
42
+		 * @throws InvalidInterfaceException
43
+		 * @throws InvalidDataTypeException
44
+		 * @throws EE_Error
45
+		 */
46
+		return static function ($input, AppContext $context, ResolveInfo $info) use ($model, $type) {
47
+			/**
48
+			 * Stop now if a user isn't allowed to create a datetime.
49
+			 */
50
+			if (! current_user_can('ee_edit_events')) {
51
+				// translators: the %1$s is the name of the object being mutated
52
+				throw new UserError(
53
+					sprintf(__('Sorry, you are not allowed to edit %1$s', 'event_espresso'), $type->name())
54
+				);
55
+			}
56
+			$id_parts = ! empty($input['id']) ? Relay::fromGlobalId($input['id']) : null;
57 57
 
58
-            $id = ! empty($id_parts['id']) && is_int($id_parts['id']) ? $id_parts['id'] : 0;
59
-            $entity = null;
58
+			$id = ! empty($id_parts['id']) && is_int($id_parts['id']) ? $id_parts['id'] : 0;
59
+			$entity = null;
60 60
 
61
-            if ($id) {
62
-                $entity = $model->get_one_by_ID($id);
63
-            }
61
+			if ($id) {
62
+				$entity = $model->get_one_by_ID($id);
63
+			}
64 64
 
65
-            /**
66
-             * If there's no existing datetime, throw an exception
67
-             */
68
-            if (! $id || ! ($entity instanceof EE_Datetime)) {
69
-                // translators: the placeholder is the name of the type being updated
70
-                throw new UserError(
71
-                    sprintf(__('No %1$s could be found to delete', 'event_espresso'), $type->name())
72
-                );
73
-            }
65
+			/**
66
+			 * If there's no existing datetime, throw an exception
67
+			 */
68
+			if (! $id || ! ($entity instanceof EE_Datetime)) {
69
+				// translators: the placeholder is the name of the type being updated
70
+				throw new UserError(
71
+					sprintf(__('No %1$s could be found to delete', 'event_espresso'), $type->name())
72
+				);
73
+			}
74 74
 
75
-            // Delete the entity
76
-            $result = ! empty($input['deletePermanently']) ? $entity->delete_permanently() : $entity->delete();
75
+			// Delete the entity
76
+			$result = ! empty($input['deletePermanently']) ? $entity->delete_permanently() : $entity->delete();
77 77
 
78
-            if (empty($result)) {
79
-                throw new UserError(__('The object failed to delete but no error was provided', 'event_espresso'));
80
-            }
78
+			if (empty($result)) {
79
+				throw new UserError(__('The object failed to delete but no error was provided', 'event_espresso'));
80
+			}
81 81
 
82
-            return [
83
-                'deleted' => $entity,
84
-            ];
85
-        };
86
-    }
82
+			return [
83
+				'deleted' => $entity,
84
+			];
85
+		};
86
+	}
87 87
 }
Please login to merge, or discard this patch.
core/domain/services/graphql/mutators/TicketUpdate.php 1 patch
Indentation   +77 added lines, -77 removed lines patch added patch discarded remove patch
@@ -21,81 +21,81 @@
 block discarded – undo
21 21
 class TicketUpdate
22 22
 {
23 23
 
24
-    /**
25
-     * Defines the mutation data modification closure.
26
-     *
27
-     * @param EEM_Ticket $model
28
-     * @param Ticket     $type
29
-     * @return callable
30
-     */
31
-    public static function mutateAndGetPayload(EEM_Ticket $model, Ticket $type)
32
-    {
33
-        /**
34
-         * Updates an entity.
35
-         *
36
-         * @param array       $input   The input for the mutation
37
-         * @param AppContext  $context The AppContext passed down to all resolvers
38
-         * @param ResolveInfo $info    The ResolveInfo passed down to all resolvers
39
-         * @return array
40
-         * @throws UserError
41
-         * @throws ReflectionException
42
-         * @throws InvalidArgumentException
43
-         * @throws InvalidInterfaceException
44
-         * @throws InvalidDataTypeException
45
-         * @throws EE_Error
46
-         */
47
-        return static function ($input, AppContext $context, ResolveInfo $info) use ($model, $type) {
48
-            /**
49
-             * Stop now if a user isn't allowed to create a datetime.
50
-             */
51
-            if (! current_user_can('ee_edit_events')) {
52
-                // translators: the %1$s is the name of the object being mutated
53
-                throw new UserError(
54
-                    sprintf(__('Sorry, you are not allowed to edit %1$s', 'event_espresso'), $type->name())
55
-                );
56
-            }
57
-            $id_parts = ! empty($input['id']) ? Relay::fromGlobalId($input['id']) : null;
58
-
59
-            $id = ! empty($id_parts['id']) && is_int($id_parts['id']) ? $id_parts['id'] : 0;
60
-            $entity = null;
61
-
62
-            if ($id) {
63
-                $entity = $model->get_one_by_ID($id);
64
-            }
65
-
66
-            /**
67
-             * If there's no existing datetime, throw an exception
68
-             */
69
-            if (! $id || ! ($entity instanceof EE_Ticket)) {
70
-                // translators: the placeholder is the name of the type being updated
71
-                throw new UserError(
72
-                    sprintf(__('No %1$s could be found to update', 'event_espresso'), $type->name())
73
-                );
74
-            }
75
-
76
-            $datetimes = [];
77
-
78
-            $args = TicketMutation::prepareFields($input);
79
-
80
-            if (isset($args['datetimes'])) {
81
-                $datetimes = $args['datetimes'];
82
-                unset($args['datetimes']);
83
-            }
84
-
85
-            // Update the entity
86
-            $result = $entity->save($args);
87
-
88
-            if (empty($result)) {
89
-                throw new UserError(__('The object failed to update but no error was provided', 'event_espresso'));
90
-            }
91
-
92
-            if (! empty($datetimes)) {
93
-                TicketMutation::setRelatedDatetimes($entity, $datetimes);
94
-            }
95
-
96
-            return [
97
-                'id' => $id,
98
-            ];
99
-        };
100
-    }
24
+	/**
25
+	 * Defines the mutation data modification closure.
26
+	 *
27
+	 * @param EEM_Ticket $model
28
+	 * @param Ticket     $type
29
+	 * @return callable
30
+	 */
31
+	public static function mutateAndGetPayload(EEM_Ticket $model, Ticket $type)
32
+	{
33
+		/**
34
+		 * Updates an entity.
35
+		 *
36
+		 * @param array       $input   The input for the mutation
37
+		 * @param AppContext  $context The AppContext passed down to all resolvers
38
+		 * @param ResolveInfo $info    The ResolveInfo passed down to all resolvers
39
+		 * @return array
40
+		 * @throws UserError
41
+		 * @throws ReflectionException
42
+		 * @throws InvalidArgumentException
43
+		 * @throws InvalidInterfaceException
44
+		 * @throws InvalidDataTypeException
45
+		 * @throws EE_Error
46
+		 */
47
+		return static function ($input, AppContext $context, ResolveInfo $info) use ($model, $type) {
48
+			/**
49
+			 * Stop now if a user isn't allowed to create a datetime.
50
+			 */
51
+			if (! current_user_can('ee_edit_events')) {
52
+				// translators: the %1$s is the name of the object being mutated
53
+				throw new UserError(
54
+					sprintf(__('Sorry, you are not allowed to edit %1$s', 'event_espresso'), $type->name())
55
+				);
56
+			}
57
+			$id_parts = ! empty($input['id']) ? Relay::fromGlobalId($input['id']) : null;
58
+
59
+			$id = ! empty($id_parts['id']) && is_int($id_parts['id']) ? $id_parts['id'] : 0;
60
+			$entity = null;
61
+
62
+			if ($id) {
63
+				$entity = $model->get_one_by_ID($id);
64
+			}
65
+
66
+			/**
67
+			 * If there's no existing datetime, throw an exception
68
+			 */
69
+			if (! $id || ! ($entity instanceof EE_Ticket)) {
70
+				// translators: the placeholder is the name of the type being updated
71
+				throw new UserError(
72
+					sprintf(__('No %1$s could be found to update', 'event_espresso'), $type->name())
73
+				);
74
+			}
75
+
76
+			$datetimes = [];
77
+
78
+			$args = TicketMutation::prepareFields($input);
79
+
80
+			if (isset($args['datetimes'])) {
81
+				$datetimes = $args['datetimes'];
82
+				unset($args['datetimes']);
83
+			}
84
+
85
+			// Update the entity
86
+			$result = $entity->save($args);
87
+
88
+			if (empty($result)) {
89
+				throw new UserError(__('The object failed to update but no error was provided', 'event_espresso'));
90
+			}
91
+
92
+			if (! empty($datetimes)) {
93
+				TicketMutation::setRelatedDatetimes($entity, $datetimes);
94
+			}
95
+
96
+			return [
97
+				'id' => $id,
98
+			];
99
+		};
100
+	}
101 101
 }
Please login to merge, or discard this patch.
core/domain/services/graphql/data/mutations/DatetimeMutation.php 2 patches
Indentation   +54 added lines, -54 removed lines patch added patch discarded remove patch
@@ -13,69 +13,69 @@
 block discarded – undo
13 13
 class DatetimeMutation
14 14
 {
15 15
 
16
-    /**
17
-     * Maps the GraphQL input to a format that the model functions can use
18
-     *
19
-     * @param array $input Data coming from the GraphQL mutation query input
20
-     * @return array
21
-     */
22
-    public static function prepareFields(array $input)
23
-    {
16
+	/**
17
+	 * Maps the GraphQL input to a format that the model functions can use
18
+	 *
19
+	 * @param array $input Data coming from the GraphQL mutation query input
20
+	 * @return array
21
+	 */
22
+	public static function prepareFields(array $input)
23
+	{
24 24
 
25
-        $args = [];
25
+		$args = [];
26 26
 
27
-        if (! empty($input['eventId'])) {
28
-            $args['EVT_ID'] = absint($input['eventId']);
29
-        } elseif (! empty($input['event'])) {
30
-            $parts = Relay::fromGlobalId($input['event']);
31
-            $args['EVT_ID'] = (! empty($parts['id']) && is_int($parts['id'])) ? $parts['id'] : null;
32
-        }
27
+		if (! empty($input['eventId'])) {
28
+			$args['EVT_ID'] = absint($input['eventId']);
29
+		} elseif (! empty($input['event'])) {
30
+			$parts = Relay::fromGlobalId($input['event']);
31
+			$args['EVT_ID'] = (! empty($parts['id']) && is_int($parts['id'])) ? $parts['id'] : null;
32
+		}
33 33
 
34
-        if (! empty($input['name'])) {
35
-            $args['DTT_name'] = sanitize_text_field($input['name']);
36
-        }
34
+		if (! empty($input['name'])) {
35
+			$args['DTT_name'] = sanitize_text_field($input['name']);
36
+		}
37 37
 
38
-        if (! empty($input['description'])) {
39
-            $args['DTT_description'] = sanitize_text_field($input['description']);
40
-        }
38
+		if (! empty($input['description'])) {
39
+			$args['DTT_description'] = sanitize_text_field($input['description']);
40
+		}
41 41
 
42
-        if (! empty($input['startDate'])) {
43
-            $args['DTT_EVT_start'] = sanitize_text_field($input['startDate']);
44
-        }
42
+		if (! empty($input['startDate'])) {
43
+			$args['DTT_EVT_start'] = sanitize_text_field($input['startDate']);
44
+		}
45 45
 
46
-        if (! empty($input['endDate'])) {
47
-            $args['DTT_EVT_end'] = sanitize_text_field($input['endDate']);
48
-        }
46
+		if (! empty($input['endDate'])) {
47
+			$args['DTT_EVT_end'] = sanitize_text_field($input['endDate']);
48
+		}
49 49
 
50
-        if (! empty($input['tickets'])) {
51
-            $args['tickets'] = array_map('sanitize_text_field', (array) $input['tickets']);
52
-        }
50
+		if (! empty($input['tickets'])) {
51
+			$args['tickets'] = array_map('sanitize_text_field', (array) $input['tickets']);
52
+		}
53 53
 
54
-        // Likewise the other fields...
54
+		// Likewise the other fields...
55 55
 
56
-        return $args;
57
-    }
56
+		return $args;
57
+	}
58 58
 
59
-    /**
60
-     * Sets the related tickets for the given datetime.
61
-     *
62
-     * @param EE_Datetime $entity  The datetime instance.
63
-     * @param array       $tickets Array of ticket IDs to relate.
64
-     */
65
-    public static function setRelatedTickets($entity, array $tickets)
66
-    {
67
-        $relationName = 'Ticket';
68
-        // Remove all the existing related tickets
69
-        $entity->_remove_relations($relationName);
59
+	/**
60
+	 * Sets the related tickets for the given datetime.
61
+	 *
62
+	 * @param EE_Datetime $entity  The datetime instance.
63
+	 * @param array       $tickets Array of ticket IDs to relate.
64
+	 */
65
+	public static function setRelatedTickets($entity, array $tickets)
66
+	{
67
+		$relationName = 'Ticket';
68
+		// Remove all the existing related tickets
69
+		$entity->_remove_relations($relationName);
70 70
 
71
-        foreach ($tickets as $ID) {
72
-            $parts = Relay::fromGlobalId($ID);
73
-            if (! empty($parts['id']) && is_int($parts['id'])) {
74
-                $entity->_add_relation_to(
75
-                    $parts['id'],
76
-                    $relationName
77
-                );
78
-            }
79
-        }
80
-    }
71
+		foreach ($tickets as $ID) {
72
+			$parts = Relay::fromGlobalId($ID);
73
+			if (! empty($parts['id']) && is_int($parts['id'])) {
74
+				$entity->_add_relation_to(
75
+					$parts['id'],
76
+					$relationName
77
+				);
78
+			}
79
+		}
80
+	}
81 81
 }
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -24,30 +24,30 @@  discard block
 block discarded – undo
24 24
 
25 25
         $args = [];
26 26
 
27
-        if (! empty($input['eventId'])) {
27
+        if ( ! empty($input['eventId'])) {
28 28
             $args['EVT_ID'] = absint($input['eventId']);
29
-        } elseif (! empty($input['event'])) {
29
+        } elseif ( ! empty($input['event'])) {
30 30
             $parts = Relay::fromGlobalId($input['event']);
31
-            $args['EVT_ID'] = (! empty($parts['id']) && is_int($parts['id'])) ? $parts['id'] : null;
31
+            $args['EVT_ID'] = ( ! empty($parts['id']) && is_int($parts['id'])) ? $parts['id'] : null;
32 32
         }
33 33
 
34
-        if (! empty($input['name'])) {
34
+        if ( ! empty($input['name'])) {
35 35
             $args['DTT_name'] = sanitize_text_field($input['name']);
36 36
         }
37 37
 
38
-        if (! empty($input['description'])) {
38
+        if ( ! empty($input['description'])) {
39 39
             $args['DTT_description'] = sanitize_text_field($input['description']);
40 40
         }
41 41
 
42
-        if (! empty($input['startDate'])) {
42
+        if ( ! empty($input['startDate'])) {
43 43
             $args['DTT_EVT_start'] = sanitize_text_field($input['startDate']);
44 44
         }
45 45
 
46
-        if (! empty($input['endDate'])) {
46
+        if ( ! empty($input['endDate'])) {
47 47
             $args['DTT_EVT_end'] = sanitize_text_field($input['endDate']);
48 48
         }
49 49
 
50
-        if (! empty($input['tickets'])) {
50
+        if ( ! empty($input['tickets'])) {
51 51
             $args['tickets'] = array_map('sanitize_text_field', (array) $input['tickets']);
52 52
         }
53 53
 
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 
71 71
         foreach ($tickets as $ID) {
72 72
             $parts = Relay::fromGlobalId($ID);
73
-            if (! empty($parts['id']) && is_int($parts['id'])) {
73
+            if ( ! empty($parts['id']) && is_int($parts['id'])) {
74 74
                 $entity->_add_relation_to(
75 75
                     $parts['id'],
76 76
                     $relationName
Please login to merge, or discard this patch.
core/domain/services/graphql/data/mutations/TicketMutation.php 2 patches
Indentation   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -13,58 +13,58 @@
 block discarded – undo
13 13
 class TicketMutation
14 14
 {
15 15
 
16
-    /**
17
-     * Maps the GraphQL input to a format that the model functions can use
18
-     *
19
-     * @param array $input Data coming from the GraphQL mutation query input
20
-     * @return array
21
-     */
22
-    public static function prepareFields(array $input)
23
-    {
16
+	/**
17
+	 * Maps the GraphQL input to a format that the model functions can use
18
+	 *
19
+	 * @param array $input Data coming from the GraphQL mutation query input
20
+	 * @return array
21
+	 */
22
+	public static function prepareFields(array $input)
23
+	{
24 24
 
25
-        $args = [];
25
+		$args = [];
26 26
 
27
-        if (! empty($input['name'])) {
28
-            $args['TKT_name'] = sanitize_text_field($input['name']);
29
-        }
27
+		if (! empty($input['name'])) {
28
+			$args['TKT_name'] = sanitize_text_field($input['name']);
29
+		}
30 30
 
31
-        if (! empty($input['description'])) {
32
-            $args['TKT_description'] = sanitize_text_field($input['description']);
33
-        }
31
+		if (! empty($input['description'])) {
32
+			$args['TKT_description'] = sanitize_text_field($input['description']);
33
+		}
34 34
 
35
-        if (! empty($input['price'])) {
36
-            $args['TKT_price'] = floatval($input['price']);
37
-        }
35
+		if (! empty($input['price'])) {
36
+			$args['TKT_price'] = floatval($input['price']);
37
+		}
38 38
 
39
-        if (! empty($input['datetimes'])) {
40
-            $args['datetimes'] = array_map('sanitize_text_field', (array) $input['datetimes']);
41
-        }
39
+		if (! empty($input['datetimes'])) {
40
+			$args['datetimes'] = array_map('sanitize_text_field', (array) $input['datetimes']);
41
+		}
42 42
 
43
-        // Likewise the other fields...
43
+		// Likewise the other fields...
44 44
 
45
-        return $args;
46
-    }
45
+		return $args;
46
+	}
47 47
 
48
-    /**
49
-     * Sets the related tickets for the given datetime.
50
-     *
51
-     * @param EE_Ticket $entity    The Ticket instance.
52
-     * @param array     $datetimes Array of datetime IDs to relate.
53
-     */
54
-    public static function setRelatedDatetimes($entity, array $datetimes)
55
-    {
56
-        $relationName = 'Datetime';
57
-        // Remove all the existing related datetimes
58
-        $entity->_remove_relations($relationName);
48
+	/**
49
+	 * Sets the related tickets for the given datetime.
50
+	 *
51
+	 * @param EE_Ticket $entity    The Ticket instance.
52
+	 * @param array     $datetimes Array of datetime IDs to relate.
53
+	 */
54
+	public static function setRelatedDatetimes($entity, array $datetimes)
55
+	{
56
+		$relationName = 'Datetime';
57
+		// Remove all the existing related datetimes
58
+		$entity->_remove_relations($relationName);
59 59
 
60
-        foreach ($datetimes as $ID) {
61
-            $parts = Relay::fromGlobalId($ID);
62
-            if (! empty($parts['id']) && is_int($parts['id'])) {
63
-                $entity->_add_relation_to(
64
-                    $parts['id'],
65
-                    $relationName
66
-                );
67
-            }
68
-        }
69
-    }
60
+		foreach ($datetimes as $ID) {
61
+			$parts = Relay::fromGlobalId($ID);
62
+			if (! empty($parts['id']) && is_int($parts['id'])) {
63
+				$entity->_add_relation_to(
64
+					$parts['id'],
65
+					$relationName
66
+				);
67
+			}
68
+		}
69
+	}
70 70
 }
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -24,19 +24,19 @@  discard block
 block discarded – undo
24 24
 
25 25
         $args = [];
26 26
 
27
-        if (! empty($input['name'])) {
27
+        if ( ! empty($input['name'])) {
28 28
             $args['TKT_name'] = sanitize_text_field($input['name']);
29 29
         }
30 30
 
31
-        if (! empty($input['description'])) {
31
+        if ( ! empty($input['description'])) {
32 32
             $args['TKT_description'] = sanitize_text_field($input['description']);
33 33
         }
34 34
 
35
-        if (! empty($input['price'])) {
35
+        if ( ! empty($input['price'])) {
36 36
             $args['TKT_price'] = floatval($input['price']);
37 37
         }
38 38
 
39
-        if (! empty($input['datetimes'])) {
39
+        if ( ! empty($input['datetimes'])) {
40 40
             $args['datetimes'] = array_map('sanitize_text_field', (array) $input['datetimes']);
41 41
         }
42 42
 
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 
60 60
         foreach ($datetimes as $ID) {
61 61
             $parts = Relay::fromGlobalId($ID);
62
-            if (! empty($parts['id']) && is_int($parts['id'])) {
62
+            if ( ! empty($parts['id']) && is_int($parts['id'])) {
63 63
                 $entity->_add_relation_to(
64 64
                     $parts['id'],
65 65
                     $relationName
Please login to merge, or discard this patch.