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