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 | 124 |
| Code Lines | 77 |
| 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 |
||
| 116 | public function testCustomBuilders() |
||
| 117 | { |
||
| 118 | $ext = new OverblogGraphQLExtension(); |
||
| 119 | $ext->load( |
||
| 120 | [ |
||
| 121 | [ |
||
| 122 | 'definitions' => [ |
||
| 123 | 'builders' => [ |
||
| 124 | 'field' => [ |
||
| 125 | 'RawId' => RawIdField::class, |
||
| 126 | ], |
||
| 127 | 'args' => [ |
||
| 128 | [ |
||
| 129 | 'alias' => 'Pager', |
||
| 130 | 'class' => PagerArgs::class, |
||
| 131 | ], |
||
| 132 | ], |
||
| 133 | ], |
||
| 134 | ], |
||
| 135 | ], |
||
| 136 | ], |
||
| 137 | $this->container |
||
| 138 | ); |
||
| 139 | |||
| 140 | $this->extension->load( |
||
| 141 | [ |
||
| 142 | [ |
||
| 143 | 'foo' => [ |
||
| 144 | 'type' => 'object', |
||
| 145 | 'config' => [ |
||
| 146 | 'fields' => [ |
||
| 147 | 'rawIDWithDescriptionOverride' => [ |
||
| 148 | 'builder' => 'RawId', |
||
| 149 | 'description' => 'rawIDWithDescriptionOverride description', |
||
| 150 | ], |
||
| 151 | 'rawID' => 'RawId', |
||
| 152 | 'rawIDs' => [ |
||
| 153 | 'type' => '[RawID!]!', |
||
| 154 | 'argsBuilder' => 'Pager', |
||
| 155 | ], |
||
| 156 | 'categories' => [ |
||
| 157 | 'type' => '[String!]!', |
||
| 158 | 'argsBuilder' => ['builder' => 'Pager'], |
||
| 159 | ], |
||
| 160 | 'categories2' => [ |
||
| 161 | 'type' => '[String!]!', |
||
| 162 | 'argsBuilder' => ['builder' => 'Pager', 'config' => ['defaultLimit' => 50]], |
||
| 163 | ], |
||
| 164 | ], |
||
| 165 | ], |
||
| 166 | ], |
||
| 167 | ], |
||
| 168 | ], |
||
| 169 | $this->container |
||
| 170 | ); |
||
| 171 | |||
| 172 | $this->assertEquals( |
||
| 173 | [ |
||
| 174 | 'foo' => [ |
||
| 175 | 'type' => 'object', |
||
| 176 | InheritanceProcessor::INHERITS_KEY => [], |
||
| 177 | 'decorator' => false, |
||
| 178 | 'config' => [ |
||
| 179 | 'name' => 'foo', |
||
| 180 | 'fields' => [ |
||
| 181 | 'rawIDWithDescriptionOverride' => [ |
||
| 182 | 'description' => 'rawIDWithDescriptionOverride description', |
||
| 183 | 'type' => 'Int!', |
||
| 184 | 'resolve' => '@=value.id', |
||
| 185 | 'args' => [], |
||
| 186 | ], |
||
| 187 | 'rawID' => [ |
||
| 188 | 'description' => 'The raw ID of an object', |
||
| 189 | 'type' => 'Int!', |
||
| 190 | 'resolve' => '@=value.id', |
||
| 191 | 'args' => [], |
||
| 192 | ], |
||
| 193 | 'rawIDs' => [ |
||
| 194 | 'type' => '[RawID!]!', |
||
| 195 | 'args' => [ |
||
| 196 | 'limit' => [ |
||
| 197 | 'type' => 'Int!', |
||
| 198 | 'defaultValue' => 20, |
||
| 199 | ], |
||
| 200 | 'offset' => [ |
||
| 201 | 'type' => 'Int!', |
||
| 202 | 'defaultValue' => 0, |
||
| 203 | ], |
||
| 204 | ], |
||
| 205 | ], |
||
| 206 | 'categories' => [ |
||
| 207 | 'type' => '[String!]!', |
||
| 208 | 'args' => [ |
||
| 209 | 'limit' => [ |
||
| 210 | 'type' => 'Int!', |
||
| 211 | 'defaultValue' => 20, |
||
| 212 | ], |
||
| 213 | 'offset' => [ |
||
| 214 | 'type' => 'Int!', |
||
| 215 | 'defaultValue' => 0, |
||
| 216 | ], |
||
| 217 | ], |
||
| 218 | ], |
||
| 219 | 'categories2' => [ |
||
| 220 | 'type' => '[String!]!', |
||
| 221 | 'args' => [ |
||
| 222 | 'limit' => [ |
||
| 223 | 'type' => 'Int!', |
||
| 224 | 'defaultValue' => 50, |
||
| 225 | ], |
||
| 226 | 'offset' => [ |
||
| 227 | 'type' => 'Int!', |
||
| 228 | 'defaultValue' => 0, |
||
| 229 | ], |
||
| 230 | ], |
||
| 231 | ], |
||
| 232 | ], |
||
| 233 | 'interfaces' => [], |
||
| 234 | ], |
||
| 235 | ], |
||
| 236 | ], |
||
| 237 | $this->container->getParameter('overblog_graphql_types.config') |
||
| 238 | ); |
||
| 239 | } |
||
| 240 | |||
| 270 |