Code Duplication    Length = 40-45 lines in 3 locations

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

@@ 303-345 (lines=43) @@
300
     * @return array|null
301
     * @since $VID:$
302
     */
303
    protected function getGraphQLDatetimes($eventId)
304
    {
305
        $field_key = lcfirst($this->namespace) . 'Datetimes';
306
        $query = <<<QUERY
307
        query GET_DATETIMES(\$where: {$this->namespace}RootQueryDatetimesConnectionWhereArgs) {
308
            {$field_key}(where: \$where) {
309
                nodes {
310
                    id
311
                    dbId
312
                    name
313
                    description
314
                    startDate
315
                    endDate
316
                    capacity
317
                    isActive
318
                    isExpired
319
                    isPrimary
320
                    isSoldOut
321
                    isUpcoming
322
                    length
323
                    order
324
                    reserved
325
                    sold
326
                    __typename
327
                }
328
                __typename
329
            }
330
        }
331
QUERY;
332
            $data = [
333
                'operation_name' => 'GET_DATETIMES',
334
                'variables' => [
335
                    'first' => 50,
336
                    'where' => [
337
                        'eventId' => $eventId,
338
                    ],
339
                ],
340
                'query' => $query,
341
            ];
342
343
            $responseData = $this->makeGraphQLRequest($data);
344
            return !empty($responseData[ $field_key ]) ? $responseData[ $field_key ] : null;
345
    }
346
347
348
    /**
@@ 353-397 (lines=45) @@
350
     * @return array|null
351
     * @since $VID:$
352
     */
353
    protected function getGraphQLTickets(array $datetimeIn)
354
    {
355
        $field_key = lcfirst($this->namespace) . 'Tickets';
356
        $query = <<<QUERY
357
        query GET_TICKETS(\$where: {$this->namespace}RootQueryTicketsConnectionWhereArgs) {
358
            {$field_key}(where: \$where) {
359
                nodes {
360
                    id
361
                    dbId
362
                    description
363
                    endDate
364
                    isDefault
365
                    isFree
366
                    isRequired
367
                    isTaxable
368
                    max
369
                    min
370
                    name
371
                    order
372
                    price
373
                    quantity
374
                    reserved
375
                    reverseCalculate
376
                    sold
377
                    startDate
378
                    uses
379
                    __typename
380
                }
381
                __typename
382
            }
383
        }
384
QUERY;
385
            $data = [
386
                'operation_name' => 'GET_TICKETS',
387
                'variables' => [
388
                    'where' => [
389
                        'datetimeIn' => $datetimeIn,
390
                    ],
391
                ],
392
                'query' => $query,
393
            ];
394
395
            $responseData = $this->makeGraphQLRequest($data);
396
            return !empty($responseData[ $field_key ]) ? $responseData[ $field_key ] : null;
397
    }
398
399
400
    /**
@@ 405-444 (lines=40) @@
402
     * @return array|null
403
     * @since $VID:$
404
     */
405
    protected function getGraphQLPrices(array $ticketIn)
406
    {
407
        $field_key = lcfirst($this->namespace) . 'Prices';
408
        $query = <<<QUERY
409
        query GET_PRICES(\$where: {$this->namespace}RootQueryPricesConnectionWhereArgs) {
410
            {$field_key}(where: \$where) {
411
                nodes {
412
                    id
413
                    dbId
414
                    amount
415
                    desc
416
                    isBasePrice
417
                    isDefault
418
                    isDeleted
419
                    isDiscount
420
                    isPercent
421
                    isTax
422
                    name
423
                    order
424
                    overrides
425
                    priceTypeOrder
426
                    __typename
427
                }
428
                __typename
429
            }
430
        }
431
QUERY;
432
            $data = [
433
                'operation_name' => 'GET_PRICES',
434
                'variables' => [
435
                    'where' => [
436
                        'ticketIn' => $ticketIn,
437
                    ],
438
                ],
439
                'query' => $query,
440
            ];
441
442
            $responseData = $this->makeGraphQLRequest($data);
443
            return !empty($responseData[ $field_key ]) ? $responseData[ $field_key ] : null;
444
    }
445
446
447
    /**