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

Prices::getData()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 37

Duplication

Lines 37
Ratio 100 %

Importance

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