We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
Conditions | 1 |
Paths | 1 |
Total Lines | 102 |
Code Lines | 46 |
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 |
||
288 | public function testAllowsQueryingTheSchemaForFieldArgs() |
||
289 | { |
||
290 | $query = ' |
||
291 | query IntrospectionQueryTypeQuery { |
||
292 | __schema { |
||
293 | queryType { |
||
294 | fields { |
||
295 | name |
||
296 | args { |
||
297 | name |
||
298 | description |
||
299 | type { |
||
300 | name |
||
301 | kind |
||
302 | ofType { |
||
303 | name |
||
304 | kind |
||
305 | } |
||
306 | } |
||
307 | defaultValue |
||
308 | } |
||
309 | } |
||
310 | } |
||
311 | } |
||
312 | } |
||
313 | '; |
||
314 | $expected = [ |
||
315 | '__schema' => [ |
||
316 | 'queryType' => [ |
||
317 | 'fields' => [ |
||
318 | [ |
||
319 | 'name' => 'hero', |
||
320 | 'args' => [ |
||
321 | [ |
||
322 | 'defaultValue' => null, |
||
323 | 'description' => "If omitted, returns the hero of the whole saga.\nIf provided, returns the hero of that particular episode.\n", |
||
324 | 'name' => 'episode', |
||
325 | 'type' => [ |
||
326 | 'kind' => 'INPUT_OBJECT', |
||
327 | 'name' => 'HeroInput', |
||
328 | 'ofType' => null, |
||
329 | ], |
||
330 | ], |
||
331 | ], |
||
332 | ], |
||
333 | [ |
||
334 | 'name' => 'human', |
||
335 | 'args' => [ |
||
336 | [ |
||
337 | 'name' => 'id', |
||
338 | 'description' => 'id of the human', |
||
339 | 'type' => [ |
||
340 | 'kind' => 'NON_NULL', |
||
341 | 'name' => null, |
||
342 | 'ofType' => [ |
||
343 | 'kind' => 'SCALAR', |
||
344 | 'name' => 'String', |
||
345 | ], |
||
346 | ], |
||
347 | 'defaultValue' => null, |
||
348 | ], |
||
349 | ], |
||
350 | ], |
||
351 | [ |
||
352 | 'name' => 'droid', |
||
353 | 'args' => [ |
||
354 | [ |
||
355 | 'name' => 'id', |
||
356 | 'description' => 'id of the droid', |
||
357 | 'type' => [ |
||
358 | 'kind' => 'NON_NULL', |
||
359 | 'name' => null, |
||
360 | 'ofType' => |
||
361 | [ |
||
362 | 'kind' => 'SCALAR', |
||
363 | 'name' => 'String', |
||
364 | ], |
||
365 | ], |
||
366 | 'defaultValue' => null, |
||
367 | ], |
||
368 | ], |
||
369 | ], |
||
370 | [ |
||
371 | 'name' => 'dateTime', |
||
372 | 'args' => [ |
||
373 | [ |
||
374 | 'name' => 'dateTime', |
||
375 | 'description' => null, |
||
376 | 'type' => [ |
||
377 | 'name' => 'DateTime', |
||
378 | 'kind' => 'SCALAR', |
||
379 | 'ofType' => null, |
||
380 | ], |
||
381 | 'defaultValue' => null, |
||
382 | ] |
||
383 | ], |
||
384 | ], |
||
385 | ], |
||
386 | ], |
||
387 | ], |
||
388 | ]; |
||
389 | $this->assertValidQuery($query, $expected); |
||
390 | } |
||
412 |