| Conditions | 1 |
| Paths | 1 |
| Total Lines | 320 |
| Code Lines | 173 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| 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 |
||
| 59 | public static function providerOperator(): iterable |
||
| 60 | { |
||
| 61 | return [ |
||
| 62 | [ |
||
| 63 | '', |
||
| 64 | BetweenOperatorType::class, |
||
| 65 | null, |
||
| 66 | ], |
||
| 67 | ['alias.field BETWEEN :filter1 AND :filter2', |
||
| 68 | BetweenOperatorType::class, |
||
| 69 | [ |
||
| 70 | 'from' => 123, |
||
| 71 | 'to' => 456, |
||
| 72 | 'not' => false, |
||
| 73 | ], |
||
| 74 | ], |
||
| 75 | [ |
||
| 76 | 'alias.field NOT BETWEEN :filter1 AND :filter2', |
||
| 77 | BetweenOperatorType::class, |
||
| 78 | [ |
||
| 79 | 'from' => 123, |
||
| 80 | 'to' => 456, |
||
| 81 | 'not' => true, |
||
| 82 | ], |
||
| 83 | ], |
||
| 84 | [ |
||
| 85 | '', |
||
| 86 | HaveOperatorType::class, |
||
| 87 | null, |
||
| 88 | 'posts', |
||
| 89 | ], |
||
| 90 | [ |
||
| 91 | 'EXISTS (SELECT 1 FROM GraphQLTests\Doctrine\Blog\Model\Post post1 WHERE post1.user = alias.id AND post1.id IN (:filter1))', |
||
| 92 | HaveOperatorType::class, |
||
| 93 | [ |
||
| 94 | 'values' => [123, 456], |
||
| 95 | 'not' => false, |
||
| 96 | ], |
||
| 97 | 'posts', |
||
| 98 | ], |
||
| 99 | [ |
||
| 100 | 'NOT EXISTS (SELECT 1 FROM GraphQLTests\Doctrine\Blog\Model\Post post1 WHERE post1.user = alias.id AND post1.id IN (:filter1))', |
||
| 101 | HaveOperatorType::class, |
||
| 102 | [ |
||
| 103 | 'values' => [123, 456], |
||
| 104 | 'not' => true, |
||
| 105 | ], |
||
| 106 | 'posts', |
||
| 107 | ], |
||
| 108 | [ |
||
| 109 | '', |
||
| 110 | HaveOperatorType::class, |
||
| 111 | null, |
||
| 112 | 'manager', |
||
| 113 | ], |
||
| 114 | [ |
||
| 115 | 'alias.manager IN (:filter1)', |
||
| 116 | HaveOperatorType::class, |
||
| 117 | [ |
||
| 118 | 'values' => [123, 456], |
||
| 119 | 'not' => false, |
||
| 120 | ], |
||
| 121 | 'manager', |
||
| 122 | ], |
||
| 123 | [ |
||
| 124 | 'alias.manager NOT IN (:filter1)', |
||
| 125 | HaveOperatorType::class, |
||
| 126 | [ |
||
| 127 | 'values' => [123, 456], |
||
| 128 | 'not' => true, |
||
| 129 | ], |
||
| 130 | 'manager', |
||
| 131 | ], |
||
| 132 | [ |
||
| 133 | ':filter1 MEMBER OF alias.favoritePosts', |
||
| 134 | HaveOperatorType::class, |
||
| 135 | [ |
||
| 136 | 'values' => [123, 456], |
||
| 137 | 'not' => false, |
||
| 138 | ], |
||
| 139 | 'favoritePosts', |
||
| 140 | ], |
||
| 141 | [ |
||
| 142 | ':filter1 NOT MEMBER OF alias.favoritePosts', |
||
| 143 | HaveOperatorType::class, |
||
| 144 | [ |
||
| 145 | 'values' => [123, 456], |
||
| 146 | 'not' => true, |
||
| 147 | ], |
||
| 148 | 'favoritePosts', |
||
| 149 | ], |
||
| 150 | [ |
||
| 151 | '', |
||
| 152 | EmptyOperatorType::class, |
||
| 153 | null, |
||
| 154 | 'posts', |
||
| 155 | ], |
||
| 156 | [ |
||
| 157 | 'alias.posts IS EMPTY', |
||
| 158 | EmptyOperatorType::class, |
||
| 159 | [ |
||
| 160 | 'not' => false, |
||
| 161 | ], |
||
| 162 | 'posts', |
||
| 163 | ], |
||
| 164 | [ |
||
| 165 | 'alias.posts IS NOT EMPTY', |
||
| 166 | EmptyOperatorType::class, |
||
| 167 | [ |
||
| 168 | 'not' => true, |
||
| 169 | ], |
||
| 170 | 'posts', |
||
| 171 | ], |
||
| 172 | [ |
||
| 173 | '', |
||
| 174 | EmptyOperatorType::class, |
||
| 175 | null, |
||
| 176 | 'manager', |
||
| 177 | ], |
||
| 178 | [ |
||
| 179 | 'alias.manager IS NULL', |
||
| 180 | EmptyOperatorType::class, |
||
| 181 | [ |
||
| 182 | 'not' => false, |
||
| 183 | ], |
||
| 184 | 'manager', |
||
| 185 | ], |
||
| 186 | [ |
||
| 187 | 'alias.manager IS NOT NULL', |
||
| 188 | EmptyOperatorType::class, |
||
| 189 | [ |
||
| 190 | 'not' => true, |
||
| 191 | ], |
||
| 192 | 'manager', |
||
| 193 | ], |
||
| 194 | [ |
||
| 195 | '', |
||
| 196 | EqualOperatorType::class, |
||
| 197 | null, |
||
| 198 | ], |
||
| 199 | [ |
||
| 200 | 'alias.field = :filter1', |
||
| 201 | EqualOperatorType::class, |
||
| 202 | [ |
||
| 203 | 'value' => 123, |
||
| 204 | 'not' => false, |
||
| 205 | ], |
||
| 206 | ], |
||
| 207 | [ |
||
| 208 | 'alias.field != :filter1', |
||
| 209 | EqualOperatorType::class, |
||
| 210 | [ |
||
| 211 | 'value' => 123, |
||
| 212 | 'not' => true, |
||
| 213 | ], |
||
| 214 | ], |
||
| 215 | [ |
||
| 216 | '', |
||
| 217 | GreaterOperatorType::class, |
||
| 218 | null, |
||
| 219 | ], |
||
| 220 | [ |
||
| 221 | 'alias.field > :filter1', |
||
| 222 | GreaterOperatorType::class, |
||
| 223 | [ |
||
| 224 | 'value' => 123, |
||
| 225 | 'not' => false, |
||
| 226 | ], |
||
| 227 | ], |
||
| 228 | [ |
||
| 229 | 'alias.field <= :filter1', |
||
| 230 | GreaterOperatorType::class, |
||
| 231 | [ |
||
| 232 | 'value' => 123, |
||
| 233 | 'not' => true, |
||
| 234 | ], |
||
| 235 | ], |
||
| 236 | [ |
||
| 237 | '', |
||
| 238 | GreaterOrEqualOperatorType::class, |
||
| 239 | null, |
||
| 240 | ], |
||
| 241 | [ |
||
| 242 | 'alias.field >= :filter1', |
||
| 243 | GreaterOrEqualOperatorType::class, |
||
| 244 | [ |
||
| 245 | 'value' => 123, |
||
| 246 | 'not' => false, |
||
| 247 | ], |
||
| 248 | ], |
||
| 249 | [ |
||
| 250 | 'alias.field < :filter1', |
||
| 251 | GreaterOrEqualOperatorType::class, |
||
| 252 | [ |
||
| 253 | 'value' => 123, |
||
| 254 | 'not' => true, |
||
| 255 | ], |
||
| 256 | ], |
||
| 257 | [ |
||
| 258 | '', |
||
| 259 | InOperatorType::class, |
||
| 260 | null, |
||
| 261 | ], |
||
| 262 | [ |
||
| 263 | 'alias.field IN (:filter1)', |
||
| 264 | InOperatorType::class, |
||
| 265 | [ |
||
| 266 | 'values' => [123, 456], |
||
| 267 | 'not' => false, |
||
| 268 | ], |
||
| 269 | ], |
||
| 270 | [ |
||
| 271 | 'alias.field NOT IN (:filter1)', |
||
| 272 | InOperatorType::class, |
||
| 273 | [ |
||
| 274 | 'values' => [123, 456], |
||
| 275 | 'not' => true, |
||
| 276 | ], |
||
| 277 | ], |
||
| 278 | [ |
||
| 279 | '', |
||
| 280 | LessOperatorType::class, |
||
| 281 | null, |
||
| 282 | ], |
||
| 283 | [ |
||
| 284 | 'alias.field < :filter1', |
||
| 285 | LessOperatorType::class, |
||
| 286 | [ |
||
| 287 | 'value' => 123, |
||
| 288 | 'not' => false, |
||
| 289 | ], |
||
| 290 | ], |
||
| 291 | [ |
||
| 292 | 'alias.field >= :filter1', |
||
| 293 | LessOperatorType::class, |
||
| 294 | [ |
||
| 295 | 'value' => 123, |
||
| 296 | 'not' => true, |
||
| 297 | ], |
||
| 298 | ], |
||
| 299 | [ |
||
| 300 | '', |
||
| 301 | LessOrEqualOperatorType::class, |
||
| 302 | null, |
||
| 303 | ], |
||
| 304 | [ |
||
| 305 | 'alias.field <= :filter1', |
||
| 306 | LessOrEqualOperatorType::class, |
||
| 307 | [ |
||
| 308 | 'value' => 123, |
||
| 309 | 'not' => false, |
||
| 310 | ], |
||
| 311 | ], |
||
| 312 | [ |
||
| 313 | 'alias.field > :filter1', |
||
| 314 | LessOrEqualOperatorType::class, |
||
| 315 | [ |
||
| 316 | 'value' => 123, |
||
| 317 | 'not' => true, |
||
| 318 | ], |
||
| 319 | ], |
||
| 320 | [ |
||
| 321 | '', |
||
| 322 | LikeOperatorType::class, |
||
| 323 | null, |
||
| 324 | ], |
||
| 325 | [ |
||
| 326 | 'alias.field LIKE :filter1', |
||
| 327 | LikeOperatorType::class, |
||
| 328 | [ |
||
| 329 | 'value' => 123, |
||
| 330 | 'not' => false, |
||
| 331 | ], |
||
| 332 | ], |
||
| 333 | [ |
||
| 334 | 'alias.field NOT LIKE :filter1', |
||
| 335 | LikeOperatorType::class, |
||
| 336 | [ |
||
| 337 | 'value' => 123, |
||
| 338 | 'not' => true, |
||
| 339 | ], |
||
| 340 | ], |
||
| 341 | [ |
||
| 342 | '', |
||
| 343 | NullOperatorType::class, |
||
| 344 | null, |
||
| 345 | ], |
||
| 346 | [ |
||
| 347 | 'alias.field IS NULL', |
||
| 348 | NullOperatorType::class, |
||
| 349 | [ |
||
| 350 | 'value' => 123, |
||
| 351 | 'not' => false, |
||
| 352 | ], |
||
| 353 | ], |
||
| 354 | [ |
||
| 355 | 'alias.field IS NOT NULL', |
||
| 356 | NullOperatorType::class, |
||
| 357 | [ |
||
| 358 | 'value' => 123, |
||
| 359 | 'not' => true, |
||
| 360 | ], |
||
| 361 | ], |
||
| 362 | [ |
||
| 363 | '', |
||
| 364 | GroupOperatorType::class, |
||
| 365 | null, |
||
| 366 | ], |
||
| 367 | [ |
||
| 368 | '', |
||
| 369 | GroupOperatorType::class, |
||
| 370 | [ |
||
| 371 | 'value' => null, |
||
| 372 | ], |
||
| 373 | ], |
||
| 374 | [ |
||
| 375 | '', |
||
| 376 | GroupOperatorType::class, |
||
| 377 | [ |
||
| 378 | 'value' => true, |
||
| 379 | ], |
||
| 384 |