Code Duplication    Length = 43-58 lines in 5 locations

core/domain/entities/admin/GraphQLData/Datetimes.php 1 location

@@ 13-63 (lines=51) @@
10
 * @author  Manzoor Wani
11
 * @since   $VID:$
12
 */
13
class Datetimes extends GraphQLData
14
{
15
16
    /**
17
     * @param array $where_params
18
     * @return array|null
19
     * @since $VID:$
20
     */
21
    public function getData(array $where_params = [])
22
    {
23
        $field_key = lcfirst($this->namespace) . 'Datetimes';
24
        $query = <<<QUERY
25
        query GET_DATETIMES(\$where: {$this->namespace}RootQueryDatetimesConnectionWhereArgs, \$first: Int, \$last: Int ) {
26
            {$field_key}(where: \$where, first: \$first, last: \$last) {
27
                nodes {
28
                    id
29
                    dbId
30
                    cacheId
31
                    capacity
32
                    description
33
                    endDate
34
                    isActive
35
                    isExpired
36
                    isPrimary
37
                    isSoldOut
38
                    isTrashed
39
                    isUpcoming
40
                    length
41
                    name
42
                    order
43
                    reserved
44
                    sold
45
                    status
46
                    startDate
47
                    __typename
48
                }
49
                __typename
50
            }
51
        }
52
QUERY;
53
        $this->setParams([
54
            'operation_name' => 'GET_DATETIMES',
55
            'variables'      => [
56
                'first' => 100,
57
            ],
58
            'query'          => $query,
59
        ]);
60
61
        return $this->getQueryResponse($field_key, $where_params);
62
    }
63
}
64

core/domain/entities/admin/GraphQLData/Event.php 1 location

@@ 5-61 (lines=57) @@
2
3
namespace EventEspresso\core\domain\entities\admin\GraphQLData;
4
5
class Event extends GraphQLData
6
{
7
8
    /**
9
     * @inheritDoc
10
     */
11
    public function getData(array $params = [])
12
    {
13
        $field_key = lcfirst($this->namespace) . 'Event';
14
        $query     = <<<QUERY
15
        query GET_EVENT(\$id: ID!) {
16
            {$field_key}(id: \$id, idType: DATABASE_ID) {
17
                id
18
                dbId
19
                cacheId
20
                allowDonations
21
                allowOverflow
22
                altRegPage
23
                created
24
                description
25
                displayDescription
26
                displayTicketSelector
27
                isActive
28
                isCancelled
29
                isExpired
30
                isInactive
31
                isPostponed
32
                isSoldOut
33
                isUpcoming
34
                maxRegistrations
35
                memberOnly
36
                name
37
                order
38
                phoneNumber
39
                shortDescription
40
                status
41
                timezoneString
42
                visibleOn
43
                wpUser {
44
                    id
45
                    name
46
                }
47
                __typename
48
            }
49
        }
50
QUERY;
51
        $this->setParams(
52
            [
53
                'operation_name' => 'GET_EVENT',
54
                'variables'      => $params,
55
                'query'          => $query,
56
            ]
57
        );
58
59
        return $this->getQueryResponse($field_key);
60
    }
61
}
62

core/domain/entities/admin/GraphQLData/Prices.php 1 location

@@ 13-58 (lines=46) @@
10
 * @author  Manzoor Wani
11
 * @since   $VID:$
12
 */
13
class Prices extends GraphQLData
14
{
15
16
    /**
17
     * @param array $where_params
18
     * @return array|null
19
     * @since $VID:$
20
     */
21
    public function getData(array $where_params = [])
22
    {
23
        $field_key = lcfirst($this->namespace) . 'Prices';
24
        $query = <<<QUERY
25
        query GET_PRICES(\$where: {$this->namespace}RootQueryPricesConnectionWhereArgs, \$first: Int, \$last: Int ) {
26
            {$field_key}(where: \$where, first: \$first, last: \$last) {
27
                nodes {
28
                    id
29
                    dbId
30
                    amount
31
                    cacheId
32
                    description
33
                    isBasePrice
34
                    isDefault
35
                    isDiscount
36
                    isPercent
37
                    isTax
38
                    isTrashed
39
                    name
40
                    order
41
                    overrides
42
                    __typename
43
                }
44
                __typename
45
            }
46
        }
47
QUERY;
48
        $this->setParams([
49
            'operation_name' => 'GET_PRICES',
50
            'variables'      => [
51
                'first' => 100,
52
            ],
53
            'query'          => $query,
54
        ]);
55
56
        return $this->getQueryResponse($field_key, $where_params);
57
    }
58
}
59

core/domain/entities/admin/GraphQLData/PriceTypes.php 1 location

@@ 13-55 (lines=43) @@
10
 * @author  Manzoor Wani
11
 * @since   $VID:$
12
 */
13
class PriceTypes extends GraphQLData
14
{
15
16
    /**
17
     * @param array $where_params
18
     * @return array|null
19
     * @since $VID:$
20
     */
21
    public function getData(array $where_params = [])
22
    {
23
        $field_key = lcfirst($this->namespace) . 'PriceTypes';
24
        $query = <<<QUERY
25
        query GET_PRICE_TYPES(\$first: Int, \$last: Int ) {
26
            {$field_key}(first: \$first, last: \$last) {
27
                nodes {
28
                    id
29
                    dbId
30
                    baseType
31
                    cacheId
32
                    isBasePrice
33
                    isDiscount
34
                    isPercent
35
                    isTax
36
                    isTrashed
37
                    name
38
                    order
39
                    __typename
40
                }
41
                __typename
42
            }
43
        }
44
QUERY;
45
        $this->setParams([
46
            'operation_name' => 'GET_PRICE_TYPES',
47
            'variables'      => [
48
                'first' => 100,
49
            ],
50
            'query'          => $query,
51
        ]);
52
53
        return $this->getQueryResponse($field_key, $where_params);
54
    }
55
}
56

core/domain/entities/admin/GraphQLData/Tickets.php 1 location

@@ 13-70 (lines=58) @@
10
 * @author  Manzoor Wani
11
 * @since   $VID:$
12
 */
13
class Tickets extends GraphQLData
14
{
15
16
    /**
17
     * @param array $where_params
18
     * @return array|null
19
     * @since $VID:$
20
     */
21
    public function getData(array $where_params = [])
22
    {
23
        $field_key = lcfirst($this->namespace) . 'Tickets';
24
        $query = <<<QUERY
25
        query GET_TICKETS(\$where: {$this->namespace}RootQueryTicketsConnectionWhereArgs, \$first: Int, \$last: Int ) {
26
            {$field_key}(where: \$where, first: \$first, last: \$last) {
27
                nodes {
28
                    id
29
                    cacheId
30
                    dbId
31
                    description
32
                    endDate
33
                    isDefault
34
                    isExpired
35
                    isFree
36
                    isOnSale
37
                    isPending
38
                    isRequired
39
                    isSoldOut
40
                    isTaxable
41
                    isTrashed
42
                    max
43
                    min
44
                    name
45
                    order
46
                    price
47
                    quantity
48
                    registrationCount
49
                    reserved
50
                    reverseCalculate
51
                    sold
52
                    startDate
53
                    uses
54
                    __typename
55
                }
56
                __typename
57
            }
58
        }
59
QUERY;
60
        $this->setParams([
61
            'operation_name' => 'GET_TICKETS',
62
            'variables'      => [
63
                'first' => 100,
64
            ],
65
            'query'          => $query,
66
        ]);
67
68
        return $this->getQueryResponse($field_key, $where_params);
69
    }
70
}
71