Conditions | 1 |
Paths | 1 |
Total Lines | 264 |
Code Lines | 176 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 1 | 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 |
||
400 | public static function countProvider(): Generator |
||
401 | { |
||
402 | yield 'Ascending forward start inclusive' => [ |
||
403 | function (Table $posts) { |
||
404 | /** @var LampagerBehavior&Table $posts */ |
||
405 | return $posts->lampager() |
||
406 | ->forward() |
||
407 | ->seekable() |
||
408 | ->limit(3) |
||
409 | ->orderByAsc('modified') |
||
410 | ->orderByAsc('id') |
||
411 | ->count(); |
||
412 | }, |
||
413 | 3, |
||
414 | ]; |
||
415 | |||
416 | yield 'Ascending forward start exclusive' => [ |
||
417 | function (Table $posts) { |
||
418 | /** @var LampagerBehavior&Table $posts */ |
||
419 | return $posts->lampager() |
||
420 | ->forward() |
||
421 | ->seekable() |
||
422 | ->exclusive() |
||
423 | ->limit(3) |
||
424 | ->orderByAsc('modified') |
||
425 | ->orderByAsc('id') |
||
426 | ->count(); |
||
427 | }, |
||
428 | 3, |
||
429 | ]; |
||
430 | |||
431 | yield 'Ascending forward inclusive' => [ |
||
432 | function (Table $posts) { |
||
433 | /** @var LampagerBehavior&Table $posts */ |
||
434 | return $posts->lampager() |
||
435 | ->forward() |
||
436 | ->seekable() |
||
437 | ->limit(3) |
||
438 | ->orderByAsc('modified') |
||
439 | ->orderByAsc('id') |
||
440 | ->cursor([ |
||
441 | 'id' => 3, |
||
442 | 'modified' => new DateTime('2017-01-01 10:00:00'), |
||
443 | ]) |
||
444 | ->count(); |
||
445 | }, |
||
446 | 3, |
||
447 | ]; |
||
448 | |||
449 | yield 'Ascending forward exclusive' => [ |
||
450 | function (Table $posts) { |
||
451 | /** @var LampagerBehavior&Table $posts */ |
||
452 | return $posts->lampager() |
||
453 | ->forward() |
||
454 | ->seekable() |
||
455 | ->exclusive() |
||
456 | ->limit(3) |
||
457 | ->orderByAsc('modified') |
||
458 | ->orderByAsc('id') |
||
459 | ->cursor([ |
||
460 | 'id' => 3, |
||
461 | 'modified' => new DateTime('2017-01-01 10:00:00'), |
||
462 | ]) |
||
463 | ->count(); |
||
464 | }, |
||
465 | 3, |
||
466 | ]; |
||
467 | |||
468 | yield 'Ascending backward start inclusive' => [ |
||
469 | function (Table $posts) { |
||
470 | /** @var LampagerBehavior&Table $posts */ |
||
471 | return $posts->lampager() |
||
472 | ->backward() |
||
473 | ->seekable() |
||
474 | ->limit(3) |
||
475 | ->orderByAsc('modified') |
||
476 | ->orderByAsc('id') |
||
477 | ->count(); |
||
478 | }, |
||
479 | 3, |
||
480 | ]; |
||
481 | |||
482 | yield 'Ascending backward start exclusive' => [ |
||
483 | function (Table $posts) { |
||
484 | /** @var LampagerBehavior&Table $posts */ |
||
485 | return $posts->lampager() |
||
486 | ->backward() |
||
487 | ->seekable() |
||
488 | ->exclusive() |
||
489 | ->limit(3) |
||
490 | ->orderByAsc('modified') |
||
491 | ->orderByAsc('id') |
||
492 | ->count(); |
||
493 | }, |
||
494 | 3, |
||
495 | ]; |
||
496 | |||
497 | yield 'Ascending backward inclusive' => [ |
||
498 | function (Table $posts) { |
||
499 | /** @var LampagerBehavior&Table $posts */ |
||
500 | return $posts->lampager() |
||
501 | ->backward() |
||
502 | ->seekable() |
||
503 | ->limit(3) |
||
504 | ->orderByAsc('modified') |
||
505 | ->orderByAsc('id') |
||
506 | ->cursor([ |
||
507 | 'id' => 3, |
||
508 | 'modified' => new DateTime('2017-01-01 10:00:00'), |
||
509 | ]) |
||
510 | ->count(); |
||
511 | }, |
||
512 | 2, |
||
513 | ]; |
||
514 | |||
515 | yield 'Ascending backward exclusive' => [ |
||
516 | function (Table $posts) { |
||
517 | /** @var LampagerBehavior&Table $posts */ |
||
518 | return $posts->lampager() |
||
519 | ->backward() |
||
520 | ->seekable() |
||
521 | ->exclusive() |
||
522 | ->limit(3) |
||
523 | ->orderByAsc('modified') |
||
524 | ->orderByAsc('id') |
||
525 | ->cursor([ |
||
526 | 'id' => 3, |
||
527 | 'modified' => new DateTime('2017-01-01 10:00:00'), |
||
528 | ]) |
||
529 | ->count(); |
||
530 | }, |
||
531 | 1, |
||
532 | ]; |
||
533 | |||
534 | yield 'Descending forward start inclusive' => [ |
||
535 | function (Table $posts) { |
||
536 | /** @var LampagerBehavior&Table $posts */ |
||
537 | return $posts->lampager() |
||
538 | ->forward() |
||
539 | ->seekable() |
||
540 | ->limit(3) |
||
541 | ->orderByDesc('modified') |
||
542 | ->orderByDesc('id') |
||
543 | ->count(); |
||
544 | }, |
||
545 | 3, |
||
546 | ]; |
||
547 | |||
548 | yield 'Descending forward start exclusive' => [ |
||
549 | function (Table $posts) { |
||
550 | /** @var LampagerBehavior&Table $posts */ |
||
551 | return $posts->lampager() |
||
552 | ->forward() |
||
553 | ->seekable() |
||
554 | ->exclusive() |
||
555 | ->limit(3) |
||
556 | ->orderByDesc('modified') |
||
557 | ->orderByDesc('id') |
||
558 | ->count(); |
||
559 | }, |
||
560 | 3, |
||
561 | ]; |
||
562 | |||
563 | yield 'Descending forward inclusive' => [ |
||
564 | function (Table $posts) { |
||
565 | /** @var LampagerBehavior&Table $posts */ |
||
566 | return $posts->lampager() |
||
567 | ->forward() |
||
568 | ->seekable() |
||
569 | ->limit(3) |
||
570 | ->orderByDesc('modified') |
||
571 | ->orderByDesc('id') |
||
572 | ->cursor([ |
||
573 | 'id' => 3, |
||
574 | 'modified' => new DateTime('2017-01-01 10:00:00'), |
||
575 | ]) |
||
576 | ->count(); |
||
577 | }, |
||
578 | 2, |
||
579 | ]; |
||
580 | |||
581 | yield 'Descending forward exclusive' => [ |
||
582 | function (Table $posts) { |
||
583 | /** @var LampagerBehavior&Table $posts */ |
||
584 | return $posts->lampager() |
||
585 | ->forward() |
||
586 | ->seekable() |
||
587 | ->exclusive() |
||
588 | ->limit(3) |
||
589 | ->orderByDesc('modified') |
||
590 | ->orderByDesc('id') |
||
591 | ->cursor([ |
||
592 | 'id' => 3, |
||
593 | 'modified' => new DateTime('2017-01-01 10:00:00'), |
||
594 | ]) |
||
595 | ->count(); |
||
596 | }, |
||
597 | 1, |
||
598 | ]; |
||
599 | |||
600 | yield 'Descending backward start inclusive' => [ |
||
601 | function (Table $posts) { |
||
602 | /** @var LampagerBehavior&Table $posts */ |
||
603 | return $posts->lampager() |
||
604 | ->backward() |
||
605 | ->seekable() |
||
606 | ->limit(3) |
||
607 | ->orderByDesc('modified') |
||
608 | ->orderByDesc('id') |
||
609 | ->count(); |
||
610 | }, |
||
611 | 3, |
||
612 | ]; |
||
613 | |||
614 | yield 'Descending backward start exclusive' => [ |
||
615 | function (Table $posts) { |
||
616 | /** @var LampagerBehavior&Table $posts */ |
||
617 | return $posts->lampager() |
||
618 | ->backward() |
||
619 | ->seekable() |
||
620 | ->exclusive() |
||
621 | ->limit(3) |
||
622 | ->orderByDesc('modified') |
||
623 | ->orderByDesc('id') |
||
624 | ->count(); |
||
625 | }, |
||
626 | 3, |
||
627 | ]; |
||
628 | |||
629 | yield 'Descending backward inclusive' => [ |
||
630 | function (Table $posts) { |
||
631 | /** @var LampagerBehavior&Table $posts */ |
||
632 | return $posts->lampager() |
||
633 | ->backward() |
||
634 | ->seekable() |
||
635 | ->limit(3) |
||
636 | ->orderByDesc('modified') |
||
637 | ->orderByDesc('id') |
||
638 | ->cursor([ |
||
639 | 'id' => 3, |
||
640 | 'modified' => new DateTime('2017-01-01 10:00:00'), |
||
641 | ]) |
||
642 | ->count(); |
||
643 | }, |
||
644 | 3, |
||
645 | ]; |
||
646 | |||
647 | yield 'Descending backward exclusive' => [ |
||
648 | function (Table $posts) { |
||
649 | /** @var LampagerBehavior&Table $posts */ |
||
650 | return $posts->lampager() |
||
651 | ->backward() |
||
652 | ->seekable() |
||
653 | ->exclusive() |
||
654 | ->limit(3) |
||
655 | ->orderByDesc('modified') |
||
656 | ->orderByDesc('id') |
||
657 | ->cursor([ |
||
658 | 'id' => 3, |
||
659 | 'modified' => new DateTime('2017-01-01 10:00:00'), |
||
660 | ]) |
||
661 | ->count(); |
||
662 | }, |
||
663 | 3, |
||
664 | ]; |
||
667 |