Code Duplication    Length = 40-48 lines in 3 locations

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

@@ 358-397 (lines=40) @@
355
     * @return array|null
356
     * @since $VID:$
357
     */
358
    protected function getGraphQLPrices(array $ticketIn)
359
    {
360
        $field_key = lcfirst($this->namespace) . 'Prices';
361
        $query = <<<QUERY
362
        query GET_PRICES(\$where: {$this->namespace}RootQueryPricesConnectionWhereArgs, \$first: Int, \$last: Int ) {
363
            {$field_key}(where: \$where, first: \$first, last: \$last) {
364
                nodes {
365
                    id
366
                    dbId
367
                    amount
368
                    cacheId
369
                    desc
370
                    isBasePrice
371
                    isDefault
372
                    isDiscount
373
                    isPercent
374
                    isTax
375
                    isTrashed
376
                    name
377
                    order
378
                    overrides
379
                    __typename
380
                }
381
                __typename
382
            }
383
        }
384
QUERY;
385
        $data = [
386
            'operation_name' => 'GET_PRICES',
387
            'variables' => [
388
                'first' => 100,
389
                'where' => [
390
                    'ticketIn' => $ticketIn,
391
                ],
392
            ],
393
            'query' => $query,
394
        ];
395
396
        $responseData = $this->makeGraphQLRequest($data);
397
        return !empty($responseData[ $field_key ]) ? $responseData[ $field_key ] : null;
398
    }
399
400
@@ 245-289 (lines=45) @@
242
     * @return array|null
243
     * @since $VID:$
244
     */
245
    protected function getGraphQLDatetimes($eventId)
246
    {
247
        $field_key = lcfirst($this->namespace) . 'Datetimes';
248
        $query = <<<QUERY
249
        query GET_DATETIMES(\$where: {$this->namespace}RootQueryDatetimesConnectionWhereArgs, \$first: Int, \$last: Int ) {
250
            {$field_key}(where: \$where, first: \$first, last: \$last) {
251
                nodes {
252
                    id
253
                    dbId
254
                    cacheId
255
                    capacity
256
                    description
257
                    endDate
258
                    isActive
259
                    isExpired
260
                    isPrimary
261
                    isSoldOut
262
                    isTrashed
263
                    isUpcoming
264
                    length
265
                    name
266
                    order
267
                    reserved
268
                    sold
269
                    status
270
                    startDate
271
                    __typename
272
                }
273
                __typename
274
            }
275
        }
276
QUERY;
277
        $data = [
278
            'operation_name' => 'GET_DATETIMES',
279
            'variables' => [
280
                'first' => 100,
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
@@ 298-345 (lines=48) @@
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, \$first: Int, \$last: Int ) {
303
            {$field_key}(where: \$where, first: \$first, last: \$last) {
304
                nodes {
305
                    id
306
                    cacheId
307
                    dbId
308
                    description
309
                    endDate
310
                    isDefault
311
                    isExpired
312
                    isFree
313
                    isOnSale
314
                    isPending
315
                    isRequired
316
                    isSoldOut
317
                    isTaxable
318
                    isTrashed
319
                    max
320
                    min
321
                    name
322
                    order
323
                    price
324
                    quantity
325
                    registrationCount
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
                'first' => 100,
341
                'where' => [
342
                    'datetimeIn' => $datetimeIn,
343
                ],
344
            ],
345
            'query' => $query,
346
        ];
347
348
        $responseData = $this->makeGraphQLRequest($data);