| 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 |
||
| 67 | public function mutationProvider() |
||
| 68 | { |
||
| 69 | return [ |
||
| 70 | [ |
||
| 71 | '{ query ( teas: $variable ) { alias: name } }', |
||
| 72 | [ |
||
| 73 | 'queries' => [ |
||
| 74 | new Query('query', null, |
||
| 75 | [ |
||
| 76 | new Argument('teas', new Variable('variable')) |
||
| 77 | ], |
||
| 78 | [ |
||
| 79 | new Field('name', 'alias') |
||
| 80 | ]) |
||
| 81 | ], |
||
| 82 | 'mutations' => [], |
||
| 83 | 'fragments' => [] |
||
| 84 | ] |
||
| 85 | ], |
||
| 86 | [ |
||
| 87 | '{ query { alias: name } }', |
||
| 88 | [ |
||
| 89 | 'queries' => [ |
||
| 90 | new Query('query', null, [], [new Field('name', 'alias')]) |
||
| 91 | ], |
||
| 92 | 'mutations' => [], |
||
| 93 | 'fragments' => [] |
||
| 94 | ] |
||
| 95 | ], |
||
| 96 | [ |
||
| 97 | 'mutation { createUser ( email: "[email protected]", active: true ) { id } }', |
||
| 98 | [ |
||
| 99 | 'queries' => [], |
||
| 100 | 'mutations' => [ |
||
| 101 | new Mutation( |
||
| 102 | 'createUser', |
||
| 103 | null, |
||
| 104 | [ |
||
| 105 | new Argument('email', new Literal('[email protected]')), |
||
| 106 | new Argument('active', new Literal(true)), |
||
| 107 | ], |
||
| 108 | [ |
||
| 109 | new Field('id') |
||
| 110 | ] |
||
| 111 | ) |
||
| 112 | ], |
||
| 113 | 'fragments' => [] |
||
| 114 | ] |
||
| 115 | ], |
||
| 116 | [ |
||
| 117 | 'mutation { test : createUser (id: 4) }', |
||
| 118 | [ |
||
| 119 | 'queries' => [], |
||
| 120 | 'mutations' => [ |
||
| 121 | new Mutation( |
||
| 122 | 'createUser', |
||
| 123 | 'test', |
||
| 124 | [ |
||
| 125 | new Argument('id', new Literal(4)), |
||
| 126 | ], |
||
| 127 | [] |
||
| 128 | ) |
||
| 129 | ], |
||
| 130 | 'fragments' => [] |
||
| 131 | ] |
||
| 132 | ] |
||
| 133 | ]; |
||
| 134 | } |
||
| 135 | |||
| 267 | } |