Code Duplication    Length = 40-45 lines in 3 locations

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

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