Conditions | 1 |
Paths | 1 |
Total Lines | 66 |
Lines | 66 |
Ratio | 100 % |
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 |
||
73 | public static function get_connection_args($args = []) |
||
74 | { |
||
75 | return array_merge( |
||
76 | [ |
||
77 | 'datetime' => [ |
||
78 | 'type' => 'ID', |
||
79 | 'description' => esc_html__( |
||
80 | 'Globally unique datetime ID to get the attendees for.', |
||
81 | 'event_espresso' |
||
82 | ), |
||
83 | ], |
||
84 | 'datetimeIn' => [ |
||
85 | 'type' => ['list_of' => 'ID'], |
||
86 | 'description' => esc_html__( |
||
87 | 'Globally unique datetime IDs to get the attendees for.', |
||
88 | 'event_espresso' |
||
89 | ), |
||
90 | ], |
||
91 | 'event' => [ |
||
92 | 'type' => 'ID', |
||
93 | 'description' => esc_html__( |
||
94 | 'Globally unique event ID to get the attendees for.', |
||
95 | 'event_espresso' |
||
96 | ), |
||
97 | ], |
||
98 | 'eventIn' => [ |
||
99 | 'type' => ['list_of' => 'ID'], |
||
100 | 'description' => esc_html__( |
||
101 | 'Globally unique event IDs to get the attendees for.', |
||
102 | 'event_espresso' |
||
103 | ), |
||
104 | ], |
||
105 | 'orderby' => [ |
||
106 | 'type' => ['list_of' => 'EspressoAttendeesConnectionOrderbyInput'], |
||
107 | 'description' => esc_html__('What parameter to use to order the objects by.', 'event_espresso'), |
||
108 | ], |
||
109 | 'regTicket' => [ |
||
110 | 'type' => 'ID', |
||
111 | 'description' => esc_html__( |
||
112 | 'Globally unique registration ticket ID to get the attendees for.', |
||
113 | 'event_espresso' |
||
114 | ), |
||
115 | ], |
||
116 | 'regTicketIn' => [ |
||
117 | 'type' => ['list_of' => 'ID'], |
||
118 | 'description' => esc_html__( |
||
119 | 'Globally unique registration ticket IDs to get the attendees for.', |
||
120 | 'event_espresso' |
||
121 | ), |
||
122 | ], |
||
123 | 'regTicketId' => [ |
||
124 | 'type' => 'Int', |
||
125 | 'description' => esc_html__('Registration ticket ID to get the attendees for.', 'event_espresso'), |
||
126 | ], |
||
127 | 'regTicketIdIn' => [ |
||
128 | 'type' => ['list_of' => 'Int'], |
||
129 | 'description' => esc_html__('Registration ticket IDs to get the attendees for.', 'event_espresso'), |
||
130 | ], |
||
131 | 'regStatus' => [ |
||
132 | 'type' => 'EspressoRegistrationStatusEnum', |
||
133 | 'description' => esc_html__('Limit attendees to registration status.', 'event_espresso'), |
||
134 | ], |
||
135 | ], |
||
136 | $args |
||
137 | ); |
||
138 | } |
||
139 | } |
||
140 |