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