| Conditions | 1 |
| Paths | 1 |
| Total Lines | 55 |
| 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 | $newArgs = [ |
||
| 78 | 'orderby' => [ |
||
| 79 | 'type' => ['list_of' => 'EspressoTicketsConnectionOrderbyInput'], |
||
| 80 | 'description' => esc_html__('What parameter to use to order the objects by.', 'event_espresso'), |
||
| 81 | ], |
||
| 82 | 'datetime' => [ |
||
| 83 | 'type' => 'ID', |
||
| 84 | 'description' => esc_html__('Globally unique datetime ID to get the tickets for.', 'event_espresso'), |
||
| 85 | ], |
||
| 86 | 'datetimeIn' => [ |
||
| 87 | 'type' => ['list_of' => 'ID'], |
||
| 88 | 'description' => esc_html__('Globally unique datetime IDs to get the tickets for.', 'event_espresso'), |
||
| 89 | ], |
||
| 90 | 'datetimeId' => [ |
||
| 91 | 'type' => 'Int', |
||
| 92 | 'description' => esc_html__('Datetime ID to get the tickets for.', 'event_espresso'), |
||
| 93 | ], |
||
| 94 | 'datetimeIdIn' => [ |
||
| 95 | 'type' => ['list_of' => 'Int'], |
||
| 96 | 'description' => esc_html__('Datetime IDs to get the tickets for.', 'event_espresso'), |
||
| 97 | ], |
||
| 98 | 'search' => [ |
||
| 99 | 'type' => 'String', |
||
| 100 | 'description' => esc_html__('The search keywords', 'event_espresso'), |
||
| 101 | ], |
||
| 102 | 'isDefault' => [ |
||
| 103 | 'type' => 'Boolean', |
||
| 104 | 'description' => esc_html__('Filter the default tickets', 'event_espresso'), |
||
| 105 | ], |
||
| 106 | 'isRequired' => [ |
||
| 107 | 'type' => 'Boolean', |
||
| 108 | 'description' => esc_html__('Filter the required tickets', 'event_espresso'), |
||
| 109 | ], |
||
| 110 | 'isTaxable' => [ |
||
| 111 | 'type' => 'Boolean', |
||
| 112 | 'description' => esc_html__('Filter the taxable tickets', 'event_espresso'), |
||
| 113 | ], |
||
| 114 | 'isTrashed' => [ |
||
| 115 | 'type' => 'Boolean', |
||
| 116 | 'description' => esc_html__('Filter the trashed tickets', 'event_espresso'), |
||
| 117 | ], |
||
| 118 | ]; |
||
| 119 | |||
| 120 | $newArgs = apply_filters( |
||
| 121 | 'FHEE__EventEspresso_core_domain_services_graphql_connections__ticket_args', |
||
| 122 | $newArgs, |
||
| 123 | $args |
||
| 124 | ); |
||
| 125 | return array_merge( |
||
| 126 | $newArgs, |
||
| 127 | $args |
||
| 128 | ); |
||
| 129 | } |
||
| 130 | } |
||
| 131 |