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 |
||
76 | public static function get_connection_args($args = []) |
||
77 | { |
||
78 | return array_merge( |
||
79 | [ |
||
80 | 'orderby' => [ |
||
81 | 'type' => ['list_of' => 'DatetimesConnectionOrderbyInput'], |
||
82 | 'description' => esc_html__('What parameter to use to order the objects by.', 'event_espresso'), |
||
83 | ], |
||
84 | 'event' => [ |
||
85 | 'type' => 'ID', |
||
86 | 'description' => esc_html__('Globally unique event ID to get the datetimes for.', 'event_espresso'), |
||
87 | ], |
||
88 | 'eventIn' => [ |
||
89 | 'type' => ['list_of' => 'ID'], |
||
90 | 'description' => esc_html__('Globally unique event IDs to get the datetimes for.', 'event_espresso'), |
||
91 | ], |
||
92 | 'eventId' => [ |
||
93 | 'type' => 'Int', |
||
94 | 'description' => esc_html__('Event ID to get the datetimes for.', 'event_espresso'), |
||
95 | ], |
||
96 | 'eventIdIn' => [ |
||
97 | 'type' => ['list_of' => 'Int'], |
||
98 | 'description' => esc_html__('Event IDs to get the datetimes for.', 'event_espresso'), |
||
99 | ], |
||
100 | 'ticket' => [ |
||
101 | 'type' => 'ID', |
||
102 | 'description' => esc_html__('Globally unique ticket ID to get the datetimes for.', 'event_espresso'), |
||
103 | ], |
||
104 | 'ticketIn' => [ |
||
105 | 'type' => ['list_of' => 'ID'], |
||
106 | 'description' => esc_html__('Globally unique ticket IDs to get the datetimes for.', 'event_espresso'), |
||
107 | ], |
||
108 | 'ticketId' => [ |
||
109 | 'type' => 'Int', |
||
110 | 'description' => esc_html__('Ticket ID to get the datetimes for.', 'event_espresso'), |
||
111 | ], |
||
112 | 'ticketIdIn' => [ |
||
113 | 'type' => ['list_of' => 'Int'], |
||
114 | 'description' => esc_html__('Ticket IDs to get the datetimes for.', 'event_espresso'), |
||
115 | ], |
||
116 | 'upcoming' => [ |
||
117 | 'type' => 'Boolean', |
||
118 | 'description' => esc_html__('Datetimes which are upcoming.', 'event_espresso'), |
||
119 | ], |
||
120 | 'active' => [ |
||
121 | 'type' => 'Boolean', |
||
122 | 'description' => esc_html__('Datetimes which are active.', 'event_espresso'), |
||
123 | ], |
||
124 | 'expired' => [ |
||
125 | 'type' => 'Boolean', |
||
126 | 'description' => esc_html__('Datetimes which are expired.', 'event_espresso'), |
||
127 | ], |
||
128 | ], |
||
129 | $args |
||
130 | ); |
||
131 | } |
||
132 | } |
||
133 |