Conditions | 1 |
Paths | 1 |
Total Lines | 120 |
Code Lines | 45 |
Lines | 0 |
Ratio | 0 % |
Changes | 7 | ||
Bugs | 1 | Features | 1 |
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 |
||
157 | public function predefinedSchemaProvider() |
||
158 | { |
||
159 | return [ |
||
160 | [ |
||
161 | '{ __type { name } }', |
||
162 | [ |
||
163 | 'errors' => ['Require "name" arguments to query "__type"'] |
||
164 | ] |
||
165 | ], |
||
166 | [ |
||
167 | '{ __type (name: "__Type") { name } }', |
||
168 | [ |
||
169 | 'data' => [ |
||
170 | '__type' => ['name' => '__Type'] |
||
171 | ] |
||
172 | ] |
||
173 | ], |
||
174 | [ |
||
175 | '{ |
||
176 | __schema { |
||
177 | types { |
||
178 | name, |
||
179 | fields { |
||
180 | name |
||
181 | } |
||
182 | } |
||
183 | } |
||
184 | }', |
||
185 | [ |
||
186 | 'data' => [ |
||
187 | '__schema' => [ |
||
188 | 'types' => [ |
||
189 | ['name' => 'latest', 'fields' => [['name' => 'id'], ['name' => 'name']]], |
||
190 | ['name' => 'Int', 'fields' => []], |
||
191 | ['name' => 'String', 'fields' => []], |
||
192 | ['name' => '__Schema', 'fields' => [['name' => 'queryType'], ['name' => 'mutationType'], ['name' => 'types'], ['name' => 'directives']]], |
||
193 | ['name' => '__Type', 'fields' => [['name' => 'name'], ['name' => 'kind'], ['name' => 'description'], ['name' => 'ofType'], ['name' => 'inputFields'], ['name' => 'enumValues'], ['name' => 'fields'], ['name' => 'interfaces'], ['name' => 'possibleTypes']]], |
||
194 | ['name' => '__InputValue', 'fields' => [['name' => 'name'],['name' => 'description'],['name' => 'type'],['name' => 'defaultValue'],]], |
||
195 | ['name' => '__EnumValue', 'fields' => [['name' => 'name'],['name' => 'description'],['name' => 'deprecationReason'],['name' => 'isDeprecated'],]], |
||
196 | ['name' => 'Boolean', 'fields' => []], |
||
197 | ['name' => '__Field', 'fields' => [['name' => 'name'], ['name' => 'description'], ['name' => 'isDeprecated'], ['name' => 'deprecationReason'], ['name' => 'type'], ['name' => 'args']]], |
||
198 | ['name' => '__Argument', 'fields' => [['name' => 'name'], ['name' => 'type'], ['name' => 'description']]], |
||
199 | ['name' => '__Interface', 'fields' => [['name' => 'name'], ['name' => 'kind'], ['name' => 'description'], ['name' => 'ofType'], ['name' => 'inputFields'], ['name' => 'enumValues'], ['name' => 'fields'], ['name' => 'interfaces'], ['name' => 'possibleTypes']]], |
||
200 | ['name' => '__PossibleOf', 'fields' => [['name' => 'name'], ['name' => 'kind'], ['name' => 'description'], ['name' => 'ofType'], ['name' => 'inputFields'], ['name' => 'enumValues'], ['name' => 'fields'], ['name' => 'interfaces'], ['name' => 'possibleTypes']]], |
||
201 | ['name' => '__Directive', 'fields' => [['name' => 'name'], ['name' => 'description'], ['name' => 'args'], ['name' => 'onOperation'], ['name' => 'onFragment'], ['name' => 'onField']]], |
||
202 | ] |
||
203 | ] |
||
204 | ] |
||
205 | ] |
||
206 | ], |
||
207 | [ |
||
208 | '{ |
||
209 | test : __schema { |
||
210 | queryType { |
||
211 | kind, |
||
212 | name, |
||
213 | fields { |
||
214 | name, |
||
215 | isDeprecated, |
||
216 | deprecationReason, |
||
217 | description, |
||
218 | type { |
||
219 | name |
||
220 | } |
||
221 | } |
||
222 | } |
||
223 | } |
||
224 | }', |
||
225 | ['data' => [ |
||
226 | 'test' => [ |
||
227 | 'queryType' => [ |
||
228 | 'name' => 'TestSchema', |
||
229 | 'kind' => 'OBJECT', |
||
230 | 'fields' => [ |
||
231 | ['name' => 'latest', 'isDeprecated' => true, 'deprecationReason' => 'for test', 'description' => 'for test', 'type' => ['name' => 'latest']], |
||
232 | ['name' => '__schema', 'isDeprecated' => false, 'deprecationReason' => '', 'description' => '', 'type' => ['name' => '__Schema']], |
||
233 | ['name' => '__type', 'isDeprecated' => false, 'deprecationReason' => '', 'description' => '', 'type' => ['name' => '__Type']] |
||
234 | ] |
||
235 | ] |
||
236 | ] |
||
237 | ]] |
||
238 | ], |
||
239 | [ |
||
240 | '{ |
||
241 | __schema { |
||
242 | queryType { |
||
243 | kind, |
||
244 | name, |
||
245 | description, |
||
246 | interfaces { |
||
247 | name |
||
248 | }, |
||
249 | possibleTypes { |
||
250 | name |
||
251 | }, |
||
252 | inputFields { |
||
253 | name |
||
254 | }, |
||
255 | ofType{ |
||
256 | name |
||
257 | } |
||
258 | } |
||
259 | } |
||
260 | }', |
||
261 | ['data' => [ |
||
262 | '__schema' => [ |
||
263 | 'queryType' => [ |
||
264 | 'kind' => 'OBJECT', |
||
265 | 'name' => 'TestSchema', |
||
266 | 'description' => 'Root of TestSchema', |
||
267 | 'interfaces' => [], |
||
268 | 'possibleTypes' => [], |
||
269 | 'inputFields' => [], |
||
270 | 'ofType' => [] |
||
271 | ] |
||
272 | ] |
||
273 | ]] |
||
274 | ] |
||
275 | ]; |
||
276 | } |
||
277 | |||
334 |