Completed
Branch EDTR/master (5c103b)
by
unknown
10:13 queued 38s
created

Datetimes::getData()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 42

Duplication

Lines 42
Ratio 100 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 1
dl 42
loc 42
rs 9.248
c 0
b 0
f 0
1
<?php
2
3
namespace EventEspresso\core\domain\entities\admin\GraphQLData;
4
5
/**
6
 * Class Datetimes
7
 * Description
8
 *
9
 * @package EventEspresso\core\domain\entities\admin\GraphQLData
10
 * @author  Manzoor Wani
11
 * @since   $VID:$
12
 */
13 View Code Duplication
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