Completed
Branch barista (8c74ff)
by
unknown
42:46 queued 33:44
created

Event   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 57
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
dl 57
loc 57
rs 10
c 0
b 0
f 0
wmc 1
lcom 1
cbo 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A getData() 50 50 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
3
namespace EventEspresso\core\domain\entities\admin\GraphQLData;
4
5 View Code Duplication
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