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