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