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 |
||
75 | public static function get_connection_args($args = []) |
||
76 | { |
||
77 | return array_merge( |
||
78 | [ |
||
79 | 'in' => [ |
||
80 | 'type' => ['list_of' => 'ID'], |
||
81 | 'description' => esc_html__('Limit pices to the given globally unique IDs', 'event_espresso'), |
||
82 | ], |
||
83 | 'idIn' => [ |
||
84 | 'type' => ['list_of' => 'ID'], |
||
85 | 'description' => esc_html__('Limit pices to the given IDs', 'event_espresso'), |
||
86 | ], |
||
87 | 'ticket' => [ |
||
88 | 'type' => 'ID', |
||
89 | 'description' => esc_html__('Globally unique ticket ID to get the prices for.', 'event_espresso'), |
||
90 | ], |
||
91 | 'ticketIn' => [ |
||
92 | 'type' => ['list_of' => 'ID'], |
||
93 | 'description' => esc_html__('Globally unique ticket IDs to get the prices for.', 'event_espresso'), |
||
94 | ], |
||
95 | 'ticketId' => [ |
||
96 | 'type' => 'Int', |
||
97 | 'description' => esc_html__('Ticket ID to get the prices for.', 'event_espresso'), |
||
98 | ], |
||
99 | 'ticketIdIn' => [ |
||
100 | 'type' => ['list_of' => 'Int'], |
||
101 | 'description' => esc_html__('Ticket IDs to get the prices for.', 'event_espresso'), |
||
102 | ], |
||
103 | 'priceType' => [ |
||
104 | 'type' => 'ID', |
||
105 | 'description' => esc_html__('Globally unique price type ID to get the prices for.', 'event_espresso'), |
||
106 | ], |
||
107 | 'priceTypeIn' => [ |
||
108 | 'type' => ['list_of' => 'ID'], |
||
109 | 'description' => esc_html__('Globally unique price type IDs to get the prices for.', 'event_espresso'), |
||
110 | ], |
||
111 | 'priceTypeId' => [ |
||
112 | 'type' => 'Int', |
||
113 | 'description' => esc_html__('Price type ID to get the prices for.', 'event_espresso'), |
||
114 | ], |
||
115 | 'priceTypeIdIn' => [ |
||
116 | 'type' => ['list_of' => 'Int'], |
||
117 | 'description' => esc_html__('Price type IDs to get the prices for.', 'event_espresso'), |
||
118 | ], |
||
119 | 'priceBaseType' => [ |
||
120 | 'type' => 'PriceBaseTypeEnum', |
||
121 | 'description' => esc_html__('Price Base type.', 'event_espresso'), |
||
122 | ], |
||
123 | 'priceBaseTypeIn' => [ |
||
124 | 'type' => ['list_of' => 'PriceBaseTypeEnum'], |
||
125 | 'description' => esc_html__('Price Base types.', 'event_espresso'), |
||
126 | ], |
||
127 | ], |
||
128 | $args |
||
129 | ); |
||
130 | } |
||
131 | } |
||
132 |