Code Duplication    Length = 40-45 lines in 3 locations

core/domain/services/admin/events/editor/AdvancedEditorData.php 3 locations

@@ 189-231 (lines=43) @@
186
     * @return array|null
187
     * @since $VID:$
188
     */
189
    protected function getGraphQLDatetimes($eventId)
190
    {
191
        $field_key = lcfirst($this->namespace) . 'Datetimes';
192
        $query = <<<QUERY
193
        query GET_DATETIMES(\$where: {$this->namespace}RootQueryDatetimesConnectionWhereArgs) {
194
            {$field_key}(where: \$where) {
195
                nodes {
196
                    id
197
                    dbId
198
                    name
199
                    description
200
                    startDate
201
                    endDate
202
                    capacity
203
                    isActive
204
                    isExpired
205
                    isPrimary
206
                    isSoldOut
207
                    isUpcoming
208
                    length
209
                    order
210
                    reserved
211
                    sold
212
                    __typename
213
                }
214
                __typename
215
            }
216
        }
217
QUERY;
218
            $data = [
219
                'operation_name' => 'GET_DATETIMES',
220
                'variables' => [
221
                    'first' => 50,
222
                    'where' => [
223
                        'eventId' => $eventId,
224
                    ],
225
                ],
226
                'query' => $query,
227
            ];
228
229
            $responseData = $this->makeGraphQLRequest($data);
230
            return !empty($responseData[ $field_key ]) ? $responseData[ $field_key ] : null;
231
    }
232
233
234
    /**
@@ 239-283 (lines=45) @@
236
     * @return array|null
237
     * @since $VID:$
238
     */
239
    protected function getGraphQLTickets(array $datetimeIn)
240
    {
241
        $field_key = lcfirst($this->namespace) . 'Tickets';
242
        $query = <<<QUERY
243
        query GET_TICKETS(\$where: {$this->namespace}RootQueryTicketsConnectionWhereArgs) {
244
            {$field_key}(where: \$where) {
245
                nodes {
246
                    id
247
                    dbId
248
                    description
249
                    endDate
250
                    isDefault
251
                    isFree
252
                    isRequired
253
                    isTaxable
254
                    max
255
                    min
256
                    name
257
                    order
258
                    price
259
                    quantity
260
                    reserved
261
                    reverseCalculate
262
                    sold
263
                    startDate
264
                    uses
265
                    __typename
266
                }
267
                __typename
268
            }
269
        }
270
QUERY;
271
            $data = [
272
                'operation_name' => 'GET_TICKETS',
273
                'variables' => [
274
                    'where' => [
275
                        'datetimeIn' => $datetimeIn,
276
                    ],
277
                ],
278
                'query' => $query,
279
            ];
280
281
            $responseData = $this->makeGraphQLRequest($data);
282
            return !empty($responseData[ $field_key ]) ? $responseData[ $field_key ] : null;
283
    }
284
285
286
    /**
@@ 291-330 (lines=40) @@
288
     * @return array|null
289
     * @since $VID:$
290
     */
291
    protected function getGraphQLPrices(array $ticketIn)
292
    {
293
        $field_key = lcfirst($this->namespace) . 'Prices';
294
        $query = <<<QUERY
295
        query GET_PRICES(\$where: {$this->namespace}RootQueryPricesConnectionWhereArgs) {
296
            {$field_key}(where: \$where) {
297
                nodes {
298
                    id
299
                    dbId
300
                    amount
301
                    desc
302
                    isBasePrice
303
                    isDefault
304
                    isDeleted
305
                    isDiscount
306
                    isPercent
307
                    isTax
308
                    name
309
                    order
310
                    overrides
311
                    priceTypeOrder
312
                    __typename
313
                }
314
                __typename
315
            }
316
        }
317
QUERY;
318
            $data = [
319
                'operation_name' => 'GET_PRICES',
320
                'variables' => [
321
                    'where' => [
322
                        'ticketIn' => $ticketIn,
323
                    ],
324
                ],
325
                'query' => $query,
326
            ];
327
328
            $responseData = $this->makeGraphQLRequest($data);
329
            return !empty($responseData[ $field_key ]) ? $responseData[ $field_key ] : null;
330
    }
331
332
333
    /**