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

CurrentUser::getData()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 28

Duplication

Lines 28
Ratio 100 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 1
dl 28
loc 28
rs 9.472
c 0
b 0
f 0
1
<?php
2
3
namespace EventEspresso\core\domain\entities\admin\GraphQLData;
4
5
/**
6
 * Class CurrentUser
7
 * Description
8
 *
9
 * @package EventEspresso\core\domain\entities\admin\GraphQLData
10
 * @author  Manzoor Wani
11
 * @since   $VID:$
12
 */
13 View Code Duplication
class CurrentUser 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 = 'viewer';
24
        $query = <<<QUERY
25
        query GET_CURRENT_USER {
26
            {$field_key} {
27
                description
28
                email
29
                firstName
30
                id
31
                name
32
                nicename
33
                nickname
34
                lastName
35
                locale
36
                userId
37
                username
38
                __typename
39
            }
40
        }
41
QUERY;
42
        $this->setParams([
43
            'operation_name' => 'GET_CURRENT_USER',
44
            'query'          => $query,
45
        ]);
46
47
        return $this->getQueryResponse($field_key, $where_params);
48
    }
49
}
50