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