Conditions | 1 |
Paths | 1 |
Total Lines | 56 |
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 |
||
96 | public static function get_connection_args($args = []) |
||
97 | { |
||
98 | return array_merge( |
||
99 | [ |
||
100 | 'orderby' => [ |
||
101 | 'type' => ['list_of' => 'DatetimesConnectionOrderbyInput'], |
||
102 | 'description' => esc_html__('What paramater to use to order the objects by.', 'event_espresso'), |
||
103 | ], |
||
104 | 'event' => [ |
||
105 | 'type' => 'ID', |
||
106 | 'description' => esc_html__('Globally unique event ID to get the datetimes for.', 'event_espresso'), |
||
107 | ], |
||
108 | 'eventIn' => [ |
||
109 | 'type' => ['list_of' => 'ID'], |
||
110 | 'description' => esc_html__('Globally unique event IDs to get the datetimes for.', 'event_espresso'), |
||
111 | ], |
||
112 | 'eventId' => [ |
||
113 | 'type' => 'Int', |
||
114 | 'description' => esc_html__('Event ID to get the datetimes for.', 'event_espresso'), |
||
115 | ], |
||
116 | 'eventIdIn' => [ |
||
117 | 'type' => ['list_of' => 'Int'], |
||
118 | 'description' => esc_html__('Event IDs to get the datetimes for.', 'event_espresso'), |
||
119 | ], |
||
120 | 'ticket' => [ |
||
121 | 'type' => 'ID', |
||
122 | 'description' => esc_html__('Globally unique ticket ID to get the datetimes for.', 'event_espresso'), |
||
123 | ], |
||
124 | 'ticketIn' => [ |
||
125 | 'type' => ['list_of' => 'ID'], |
||
126 | 'description' => esc_html__('Globally unique ticket IDs to get the datetimes for.', 'event_espresso'), |
||
127 | ], |
||
128 | 'ticketId' => [ |
||
129 | 'type' => 'Int', |
||
130 | 'description' => esc_html__('Ticket ID to get the datetimes for.', 'event_espresso'), |
||
131 | ], |
||
132 | 'ticketIdIn' => [ |
||
133 | 'type' => ['list_of' => 'Int'], |
||
134 | 'description' => esc_html__('Ticket IDs to get the datetimes for.', 'event_espresso'), |
||
135 | ], |
||
136 | 'upcoming' => [ |
||
137 | 'type' => 'Boolean', |
||
138 | 'description' => esc_html__('Datetimes which are upcoming.', 'event_espresso'), |
||
139 | ], |
||
140 | 'active' => [ |
||
141 | 'type' => 'Boolean', |
||
142 | 'description' => esc_html__('Datetimes which are active.', 'event_espresso'), |
||
143 | ], |
||
144 | 'expired' => [ |
||
145 | 'type' => 'Boolean', |
||
146 | 'description' => esc_html__('Datetimes which are expired.', 'event_espresso'), |
||
147 | ], |
||
148 | ], |
||
149 | $args |
||
150 | ); |
||
151 | } |
||
152 | } |
||
153 |