Conditions | 1 |
Paths | 1 |
Total Lines | 100 |
Code Lines | 51 |
Lines | 0 |
Ratio | 0 % |
Changes | 3 | ||
Bugs | 2 | Features | 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 |
||
119 | public function queryProvider() |
||
120 | { |
||
121 | return [ |
||
122 | [ |
||
123 | '{}', |
||
124 | [ |
||
125 | 'queries' => [], |
||
126 | 'mutations' => [], |
||
127 | 'fragments' => [] |
||
128 | ] |
||
129 | ], |
||
130 | [ |
||
131 | '{ user (id: 10, name: "max", float: 123.123 ) { id, name } }', |
||
132 | [ |
||
133 | 'queries' => [ |
||
134 | new Query( |
||
135 | 'user', |
||
136 | null, |
||
137 | [ |
||
138 | new Argument('id', new Literal('10')), |
||
139 | new Argument('name', new Literal('max')), |
||
140 | new Argument('float', new Literal('123.123')) |
||
141 | ], |
||
142 | [ |
||
143 | new Field('id'), |
||
144 | new Field('name') |
||
145 | ] |
||
146 | ) |
||
147 | ], |
||
148 | 'mutations' => [], |
||
149 | 'fragments' => [] |
||
150 | ] |
||
151 | ], |
||
152 | [ |
||
153 | '{ allUsers : users ( id: [ 1, 2, 3] ) { id } }', |
||
154 | [ |
||
155 | 'queries' => [ |
||
156 | new Query( |
||
157 | 'users', |
||
158 | 'allUsers', |
||
159 | [ |
||
160 | new Argument('id', new InputList([1, 2, 3])) |
||
161 | ], |
||
162 | [ |
||
163 | new Field('id') |
||
164 | ] |
||
165 | ) |
||
166 | ], |
||
167 | 'mutations' => [], |
||
168 | 'fragments' => [] |
||
169 | ] |
||
170 | ], |
||
171 | [ |
||
172 | '{ allUsers : users ( id: [ 1, "2", true, null] ) { id } }', |
||
173 | [ |
||
174 | 'queries' => [ |
||
175 | new Query( |
||
176 | 'users', |
||
177 | 'allUsers', |
||
178 | [ |
||
179 | new Argument('id', new InputList([1, "2", true, null])) |
||
180 | ], |
||
181 | [ |
||
182 | new Field('id') |
||
183 | ] |
||
184 | ) |
||
185 | ], |
||
186 | 'mutations' => [], |
||
187 | 'fragments' => [] |
||
188 | ] |
||
189 | ], |
||
190 | [ |
||
191 | '{ allUsers : users ( object: { "a": 123, "d": "asd", "b" : [ 1, 2, 4 ], "c": { "a" : 123, "b": "asd" } } ) { id } }', |
||
192 | [ |
||
193 | 'queries' => [ |
||
194 | new Query( |
||
195 | 'users', |
||
196 | 'allUsers', |
||
197 | [ |
||
198 | new Argument('object', new InputObject([ |
||
199 | 'a' => 123, |
||
200 | 'd' => 'asd', |
||
201 | 'b' => [1, 2, 4], |
||
202 | 'c' => [ |
||
203 | 'a' => 123, |
||
204 | 'b' => 'asd' |
||
205 | ] |
||
206 | ])) |
||
207 | ], |
||
208 | [ |
||
209 | new Field('id') |
||
210 | ] |
||
211 | ) |
||
212 | ], |
||
213 | 'mutations' => [], |
||
214 | 'fragments' => [] |
||
215 | ] |
||
216 | ] |
||
217 | ]; |
||
218 | } |
||
219 | |||
220 | } |