Conditions | 1 |
Paths | 1 |
Total Lines | 53 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
1 | <?php |
||
11 | public function getData(array $where_params = []) |
||
12 | { |
||
13 | $field_key = lcfirst($this->namespace) . 'Events'; |
||
14 | $query = <<<QUERY |
||
15 | query GET_EVENTS(\$where: {$this->namespace}RootQueryEventsConnectionWhereArgs, \$first: Int, \$last: Int ) { |
||
16 | {$field_key}(where: \$where, first: \$first, last: \$last) { |
||
17 | nodes { |
||
18 | id |
||
19 | dbId |
||
20 | cacheId |
||
21 | additionalLimit |
||
22 | allowOverflow |
||
23 | created |
||
24 | description |
||
25 | displayDescription |
||
26 | displayTicketSelector |
||
27 | externalUrl |
||
28 | isActive |
||
29 | isCancelled |
||
30 | isExpired |
||
31 | isInactive |
||
32 | isPostponed |
||
33 | isSoldOut |
||
34 | isTrashed |
||
35 | isUpcoming |
||
36 | memberOnly |
||
37 | name |
||
38 | order |
||
39 | phone |
||
40 | shortDescription |
||
41 | status |
||
42 | timezoneString |
||
43 | visibleOn |
||
44 | wpUser |
||
45 | __typename |
||
46 | } |
||
47 | __typename |
||
48 | } |
||
49 | } |
||
50 | QUERY; |
||
51 | $this->setParams( |
||
52 | [ |
||
53 | 'operation_name' => 'GET_EVENTS', |
||
54 | 'variables' => [ |
||
55 | 'first' => 500, |
||
56 | ], |
||
57 | 'query' => $query, |
||
58 | ] |
||
59 | ); |
||
60 | \EEH_Debug_Tools::printr($query, '$query', __FILE__, __LINE__); |
||
61 | |||
62 | return $this->getQueryResponse($field_key, $where_params); |
||
63 | } |
||
64 | } |
||
65 |