Code Duplication    Length = 40-45 lines in 3 locations

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

@@ 248-290 (lines=43) @@
245
     * @return array|null
246
     * @since $VID:$
247
     */
248
    protected function getGraphQLDatetimes($eventId)
249
    {
250
        $field_key = lcfirst($this->namespace) . 'Datetimes';
251
        $query = <<<QUERY
252
        query GET_DATETIMES(\$where: {$this->namespace}RootQueryDatetimesConnectionWhereArgs) {
253
            {$field_key}(where: \$where) {
254
                nodes {
255
                    id
256
                    dbId
257
                    name
258
                    description
259
                    startDate
260
                    endDate
261
                    capacity
262
                    isActive
263
                    isExpired
264
                    isPrimary
265
                    isSoldOut
266
                    isUpcoming
267
                    length
268
                    order
269
                    reserved
270
                    sold
271
                    __typename
272
                }
273
                __typename
274
            }
275
        }
276
QUERY;
277
            $data = [
278
                'operation_name' => 'GET_DATETIMES',
279
                'variables' => [
280
                    'first' => 50,
281
                    'where' => [
282
                        'eventId' => $eventId,
283
                    ],
284
                ],
285
                'query' => $query,
286
            ];
287
288
            $responseData = $this->makeGraphQLRequest($data);
289
            return !empty($responseData[ $field_key ]) ? $responseData[ $field_key ] : null;
290
    }
291
292
293
    /**
@@ 298-342 (lines=45) @@
295
     * @return array|null
296
     * @since $VID:$
297
     */
298
    protected function getGraphQLTickets(array $datetimeIn)
299
    {
300
        $field_key = lcfirst($this->namespace) . 'Tickets';
301
        $query = <<<QUERY
302
        query GET_TICKETS(\$where: {$this->namespace}RootQueryTicketsConnectionWhereArgs) {
303
            {$field_key}(where: \$where) {
304
                nodes {
305
                    id
306
                    dbId
307
                    description
308
                    endDate
309
                    isDefault
310
                    isFree
311
                    isRequired
312
                    isTaxable
313
                    max
314
                    min
315
                    name
316
                    order
317
                    price
318
                    quantity
319
                    reserved
320
                    reverseCalculate
321
                    sold
322
                    startDate
323
                    uses
324
                    __typename
325
                }
326
                __typename
327
            }
328
        }
329
QUERY;
330
            $data = [
331
                'operation_name' => 'GET_TICKETS',
332
                'variables' => [
333
                    'where' => [
334
                        'datetimeIn' => $datetimeIn,
335
                    ],
336
                ],
337
                'query' => $query,
338
            ];
339
340
            $responseData = $this->makeGraphQLRequest($data);
341
            return !empty($responseData[ $field_key ]) ? $responseData[ $field_key ] : null;
342
    }
343
344
345
    /**
@@ 350-389 (lines=40) @@
347
     * @return array|null
348
     * @since $VID:$
349
     */
350
    protected function getGraphQLPrices(array $ticketIn)
351
    {
352
        $field_key = lcfirst($this->namespace) . 'Prices';
353
        $query = <<<QUERY
354
        query GET_PRICES(\$where: {$this->namespace}RootQueryPricesConnectionWhereArgs) {
355
            {$field_key}(where: \$where) {
356
                nodes {
357
                    id
358
                    dbId
359
                    amount
360
                    desc
361
                    isBasePrice
362
                    isDefault
363
                    isDeleted
364
                    isDiscount
365
                    isPercent
366
                    isTax
367
                    name
368
                    order
369
                    overrides
370
                    priceTypeOrder
371
                    __typename
372
                }
373
                __typename
374
            }
375
        }
376
QUERY;
377
            $data = [
378
                'operation_name' => 'GET_PRICES',
379
                'variables' => [
380
                    'where' => [
381
                        'ticketIn' => $ticketIn,
382
                    ],
383
                ],
384
                'query' => $query,
385
            ];
386
387
            $responseData = $this->makeGraphQLRequest($data);
388
            return !empty($responseData[ $field_key ]) ? $responseData[ $field_key ] : null;
389
    }
390
391
392
    /**