Conditions | 1 |
Paths | 1 |
Total Lines | 68 |
Code Lines | 32 |
Lines | 0 |
Ratio | 0 % |
Changes | 5 | ||
Bugs | 2 | Features | 2 |
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 |
||
36 | public function mutationProvider() |
||
37 | { |
||
38 | return [ |
||
39 | [ |
||
40 | '{ query ( teas: $variable ) { alias: name } }', |
||
41 | [ |
||
42 | 'queries' => [ |
||
43 | new Query('query', null, |
||
44 | [ |
||
45 | new Argument('teas', new Variable('variable')) |
||
46 | ], |
||
47 | [ |
||
48 | new Field('name', 'alias') |
||
49 | ]) |
||
50 | ], |
||
51 | 'mutations' => [], |
||
52 | 'fragments' => [] |
||
53 | ] |
||
54 | ], |
||
55 | [ |
||
56 | '{ query { alias: name } }', |
||
57 | [ |
||
58 | 'queries' => [ |
||
59 | new Query('query', null, [], [new Field('name', 'alias')]) |
||
60 | ], |
||
61 | 'mutations' => [], |
||
62 | 'fragments' => [] |
||
63 | ] |
||
64 | ], |
||
65 | [ |
||
66 | 'mutation { createUser ( email: "[email protected]", active: true ) { id } }', |
||
67 | [ |
||
68 | 'queries' => [], |
||
69 | 'mutations' => [ |
||
70 | new Mutation( |
||
71 | 'createUser', |
||
72 | null, |
||
73 | [ |
||
74 | new Argument('email', new Literal('[email protected]')), |
||
75 | new Argument('active', new Literal(true)), |
||
76 | ], |
||
77 | [ |
||
78 | new Field('id') |
||
79 | ] |
||
80 | ) |
||
81 | ], |
||
82 | 'fragments' => [] |
||
83 | ] |
||
84 | ], |
||
85 | [ |
||
86 | 'mutation { test : createUser (id: 4) }', |
||
87 | [ |
||
88 | 'queries' => [], |
||
89 | 'mutations' => [ |
||
90 | new Mutation( |
||
91 | 'createUser', |
||
92 | 'test', |
||
93 | [ |
||
94 | new Argument('id', new Literal(4)), |
||
95 | ], |
||
96 | [] |
||
97 | ) |
||
98 | ], |
||
99 | 'fragments' => [] |
||
100 | ] |
||
101 | ] |
||
102 | ]; |
||
103 | } |
||
104 | |||
220 | } |