| Conditions | 1 | 
| Paths | 1 | 
| Total Lines | 268 | 
| Code Lines | 164 | 
| 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  | 
            ||
| 565 | public function queryProvider()  | 
            ||
| 566 |     { | 
            ||
| 567 | return [  | 
            ||
| 568 | [  | 
            ||
| 569 |                 '{ film(id: 1 filmID: 2) { title } }', | 
            ||
| 570 | [  | 
            ||
| 571 | 'queries' => [  | 
            ||
| 572 |                         new Query('film', null, [ | 
            ||
| 573 |                             new Argument('id', new Literal(1, new Location(1, 12)), new Location(1, 8)), | 
            ||
| 574 |                             new Argument('filmID', new Literal(2, new Location(1, 22)), new Location(1, 14)), | 
            ||
| 575 | ], [  | 
            ||
| 576 |                             new Field('title', null, [], [], new Location(1, 27)), | 
            ||
| 577 | ], [], new Location(1, 3)),  | 
            ||
| 578 | ],  | 
            ||
| 579 | 'mutations' => [],  | 
            ||
| 580 | 'fragments' => [],  | 
            ||
| 581 | 'fragmentReferences' => [],  | 
            ||
| 582 | 'variables' => [],  | 
            ||
| 583 | 'variableReferences' => [],  | 
            ||
| 584 | ],  | 
            ||
| 585 | ],  | 
            ||
| 586 | [  | 
            ||
| 587 |                 '{ test (id: -5) { id } } ', | 
            ||
| 588 | [  | 
            ||
| 589 | 'queries' => [  | 
            ||
| 590 |                         new Query('test', null, [ | 
            ||
| 591 |                             new Argument('id', new Literal(-5, new Location(1, 13)), new Location(1, 9)), | 
            ||
| 592 | ], [  | 
            ||
| 593 |                             new Field('id', null, [], [], new Location(1, 19)), | 
            ||
| 594 | ], [], new Location(1, 3)),  | 
            ||
| 595 | ],  | 
            ||
| 596 | 'mutations' => [],  | 
            ||
| 597 | 'fragments' => [],  | 
            ||
| 598 | 'fragmentReferences' => [],  | 
            ||
| 599 | 'variables' => [],  | 
            ||
| 600 | 'variableReferences' => [],  | 
            ||
| 601 | ],  | 
            ||
| 602 | ],  | 
            ||
| 603 | [  | 
            ||
| 604 |                 "{ test (id: -5) \r\n { id } } ", | 
            ||
| 605 | [  | 
            ||
| 606 | 'queries' => [  | 
            ||
| 607 |                         new Query('test', null, [ | 
            ||
| 608 |                             new Argument('id', new Literal(-5, new Location(1, 13)), new Location(1, 9)), | 
            ||
| 609 | ], [  | 
            ||
| 610 |                             new Field('id', null, [], [], new Location(2, 4)), | 
            ||
| 611 | ], [], new Location(1, 3)),  | 
            ||
| 612 | ],  | 
            ||
| 613 | 'mutations' => [],  | 
            ||
| 614 | 'fragments' => [],  | 
            ||
| 615 | 'fragmentReferences' => [],  | 
            ||
| 616 | 'variables' => [],  | 
            ||
| 617 | 'variableReferences' => [],  | 
            ||
| 618 | ],  | 
            ||
| 619 | ],  | 
            ||
| 620 | [  | 
            ||
| 621 |                 'query CheckTypeOfLuke { | 
            ||
| 622 |                   hero(episode: EMPIRE) { | 
            ||
| 623 | __typename,  | 
            ||
| 624 | name  | 
            ||
| 625 | }  | 
            ||
| 626 | }',  | 
            ||
| 627 | [  | 
            ||
| 628 | 'queries' => [  | 
            ||
| 629 |                         new Query('hero', null, [ | 
            ||
| 630 |                             new Argument('episode', new Literal('EMPIRE', new Location(2, 33)), new Location(2, 24)), | 
            ||
| 631 | ], [  | 
            ||
| 632 |                             new Field('__typename', null, [], [], new Location(3, 21)), | 
            ||
| 633 |                             new Field('name', null, [], [], new Location(4, 21)), | 
            ||
| 634 | ], [], new Location(2, 19)),  | 
            ||
| 635 | ],  | 
            ||
| 636 | 'mutations' => [],  | 
            ||
| 637 | 'fragments' => [],  | 
            ||
| 638 | 'fragmentReferences' => [],  | 
            ||
| 639 | 'variables' => [],  | 
            ||
| 640 | 'variableReferences' => [],  | 
            ||
| 641 | ],  | 
            ||
| 642 | ],  | 
            ||
| 643 | [  | 
            ||
| 644 |                 '{ test { __typename, id } }', | 
            ||
| 645 | [  | 
            ||
| 646 | 'queries' => [  | 
            ||
| 647 |                         new Query('test', null, [], [ | 
            ||
| 648 |                             new Field('__typename', null, [], [], new Location(1, 10)), | 
            ||
| 649 |                             new Field('id', null, [], [], new Location(1, 22)), | 
            ||
| 650 | ], [], new Location(1, 3)),  | 
            ||
| 651 | ],  | 
            ||
| 652 | 'mutations' => [],  | 
            ||
| 653 | 'fragments' => [],  | 
            ||
| 654 | 'fragmentReferences' => [],  | 
            ||
| 655 | 'variables' => [],  | 
            ||
| 656 | 'variableReferences' => [],  | 
            ||
| 657 | ],  | 
            ||
| 658 | ],  | 
            ||
| 659 | [  | 
            ||
| 660 |                 '{}', | 
            ||
| 661 | [  | 
            ||
| 662 | 'queries' => [],  | 
            ||
| 663 | 'mutations' => [],  | 
            ||
| 664 | 'fragments' => [],  | 
            ||
| 665 | 'fragmentReferences' => [],  | 
            ||
| 666 | 'variables' => [],  | 
            ||
| 667 | 'variableReferences' => [],  | 
            ||
| 668 | ],  | 
            ||
| 669 | ],  | 
            ||
| 670 | [  | 
            ||
| 671 |                 'query test {}', | 
            ||
| 672 | [  | 
            ||
| 673 | 'queries' => [],  | 
            ||
| 674 | 'mutations' => [],  | 
            ||
| 675 | 'fragments' => [],  | 
            ||
| 676 | 'fragmentReferences' => [],  | 
            ||
| 677 | 'variables' => [],  | 
            ||
| 678 | 'variableReferences' => [],  | 
            ||
| 679 | ],  | 
            ||
| 680 | ],  | 
            ||
| 681 | [  | 
            ||
| 682 |                 'query {}', | 
            ||
| 683 | [  | 
            ||
| 684 | 'queries' => [],  | 
            ||
| 685 | 'mutations' => [],  | 
            ||
| 686 | 'fragments' => [],  | 
            ||
| 687 | 'fragmentReferences' => [],  | 
            ||
| 688 | 'variables' => [],  | 
            ||
| 689 | 'variableReferences' => [],  | 
            ||
| 690 | ],  | 
            ||
| 691 | ],  | 
            ||
| 692 | [  | 
            ||
| 693 |                 'mutation setName { setUserName }', | 
            ||
| 694 | [  | 
            ||
| 695 | 'queries' => [],  | 
            ||
| 696 |                     'mutations'          => [new Mutation('setUserName', null, [], [], [], new Location(1, 20))], | 
            ||
| 697 | 'fragments' => [],  | 
            ||
| 698 | 'fragmentReferences' => [],  | 
            ||
| 699 | 'variables' => [],  | 
            ||
| 700 | 'variableReferences' => [],  | 
            ||
| 701 | ],  | 
            ||
| 702 | ],  | 
            ||
| 703 | [  | 
            ||
| 704 |                 '{ test { ...userDataFragment } } fragment userDataFragment on User { id, name, email }', | 
            ||
| 705 | [  | 
            ||
| 706 | 'queries' => [  | 
            ||
| 707 |                         new Query('test', null, [], [new FragmentReference('userDataFragment', new Location(1, 13))], [], new Location(1, 3)), | 
            ||
| 708 | ],  | 
            ||
| 709 | 'mutations' => [],  | 
            ||
| 710 | 'fragments' => [  | 
            ||
| 711 |                         new Fragment('userDataFragment', 'User', [], [ | 
            ||
| 712 |                             new Field('id', null, [], [], new Location(1, 70)), | 
            ||
| 713 |                             new Field('name', null, [], [], new Location(1, 74)), | 
            ||
| 714 |                             new Field('email', null, [], [], new Location(1, 80)), | 
            ||
| 715 | ], new Location(1, 43)),  | 
            ||
| 716 | ],  | 
            ||
| 717 | 'fragmentReferences' => [  | 
            ||
| 718 |                         new FragmentReference('userDataFragment', new Location(1, 13)), | 
            ||
| 719 | ],  | 
            ||
| 720 | 'variables' => [],  | 
            ||
| 721 | 'variableReferences' => [],  | 
            ||
| 722 | ],  | 
            ||
| 723 | ],  | 
            ||
| 724 | [  | 
            ||
| 725 |                 '{ user (id: 10, name: "max", float: 123.123 ) { id, name } }', | 
            ||
| 726 | [  | 
            ||
| 727 | 'queries' => [  | 
            ||
| 728 | new Query(  | 
            ||
| 729 | 'user',  | 
            ||
| 730 | null,  | 
            ||
| 731 | [  | 
            ||
| 732 |                                 new Argument('id', new Literal('10', new Location(1, 13)), new Location(1, 9)), | 
            ||
| 733 |                                 new Argument('name', new Literal('max', new Location(1, 24)), new Location(1, 17)), | 
            ||
| 734 |                                 new Argument('float', new Literal('123.123', new Location(1, 37)), new Location(1, 30)), | 
            ||
| 735 | ],  | 
            ||
| 736 | [  | 
            ||
| 737 |                                 new Field('id', null, [], [], new Location(1, 49)), | 
            ||
| 738 |                                 new Field('name', null, [], [], new Location(1, 53)), | 
            ||
| 739 | ],  | 
            ||
| 740 | [],  | 
            ||
| 741 | new Location(1, 3)  | 
            ||
| 742 | ),  | 
            ||
| 743 | ],  | 
            ||
| 744 | 'mutations' => [],  | 
            ||
| 745 | 'fragments' => [],  | 
            ||
| 746 | 'fragmentReferences' => [],  | 
            ||
| 747 | 'variables' => [],  | 
            ||
| 748 | 'variableReferences' => [],  | 
            ||
| 749 | ],  | 
            ||
| 750 | ],  | 
            ||
| 751 | [  | 
            ||
| 752 |                 '{ allUsers : users ( id: [ 1, 2, 3] ) { id } }', | 
            ||
| 753 | [  | 
            ||
| 754 | 'queries' => [  | 
            ||
| 755 | new Query(  | 
            ||
| 756 | 'users',  | 
            ||
| 757 | 'allUsers',  | 
            ||
| 758 | [  | 
            ||
| 759 |                                 new Argument('id', new InputList([1, 2, 3], new Location(1, 26)), new Location(1, 22)), | 
            ||
| 760 | ],  | 
            ||
| 761 | [  | 
            ||
| 762 |                                 new Field('id', null, [], [], new Location(1, 41)), | 
            ||
| 763 | ],  | 
            ||
| 764 | [],  | 
            ||
| 765 | new Location(1, 14)  | 
            ||
| 766 | ),  | 
            ||
| 767 | ],  | 
            ||
| 768 | 'mutations' => [],  | 
            ||
| 769 | 'fragments' => [],  | 
            ||
| 770 | 'fragmentReferences' => [],  | 
            ||
| 771 | 'variables' => [],  | 
            ||
| 772 | 'variableReferences' => [],  | 
            ||
| 773 | ],  | 
            ||
| 774 | ],  | 
            ||
| 775 | [  | 
            ||
| 776 |                 '{ allUsers : users ( id: [ 1, "2", true, null] ) { id } }', | 
            ||
| 777 | [  | 
            ||
| 778 | 'queries' => [  | 
            ||
| 779 | new Query(  | 
            ||
| 780 | 'users',  | 
            ||
| 781 | 'allUsers',  | 
            ||
| 782 | [  | 
            ||
| 783 |                                 new Argument('id', new InputList([1, "2", true, null], new Location(1, 26)), new Location(1, 22)), | 
            ||
| 784 | ],  | 
            ||
| 785 | [  | 
            ||
| 786 |                                 new Field('id', null, [], [], new Location(1, 52)), | 
            ||
| 787 | ],  | 
            ||
| 788 | [],  | 
            ||
| 789 | new Location(1, 14)  | 
            ||
| 790 | ),  | 
            ||
| 791 | ],  | 
            ||
| 792 | 'mutations' => [],  | 
            ||
| 793 | 'fragments' => [],  | 
            ||
| 794 | 'fragmentReferences' => [],  | 
            ||
| 795 | 'variables' => [],  | 
            ||
| 796 | 'variableReferences' => [],  | 
            ||
| 797 | ],  | 
            ||
| 798 | ],  | 
            ||
| 799 | [  | 
            ||
| 800 |                 '{ allUsers : users ( object: { "a": 123, "d": "asd",  "b" : [ 1, 2, 4 ], "c": { "a" : 123, "b":  "asd" } } ) { id } }', | 
            ||
| 801 | [  | 
            ||
| 802 | 'queries' => [  | 
            ||
| 803 | new Query(  | 
            ||
| 804 | 'users',  | 
            ||
| 805 | 'allUsers',  | 
            ||
| 806 | [  | 
            ||
| 807 |                                 new Argument('object', new InputObject([ | 
            ||
| 808 | 'a' => 123,  | 
            ||
| 809 | 'd' => 'asd',  | 
            ||
| 810 | 'b' => [1, 2, 4],  | 
            ||
| 811 | 'c' => new InputObject([  | 
            ||
| 812 | 'a' => 123,  | 
            ||
| 813 | 'b' => 'asd',  | 
            ||
| 814 | ], new Location(1, 79)),  | 
            ||
| 815 | ], new Location(1, 30)), new Location(1, 22)),  | 
            ||
| 816 | ],  | 
            ||
| 817 | [  | 
            ||
| 818 |                                 new Field('id', null, [], [], new Location(1, 112)), | 
            ||
| 819 | ],  | 
            ||
| 820 | [],  | 
            ||
| 821 | new Location(1, 14)  | 
            ||
| 822 | ),  | 
            ||
| 823 | ],  | 
            ||
| 824 | 'mutations' => [],  | 
            ||
| 825 | 'fragments' => [],  | 
            ||
| 826 | 'fragmentReferences' => [],  | 
            ||
| 827 | 'variables' => [],  | 
            ||
| 828 | 'variableReferences' => [],  | 
            ||
| 829 | ],  | 
            ||
| 830 | ],  | 
            ||
| 831 | ];  | 
            ||
| 832 | }  | 
            ||
| 833 | |||
| 895 | 
Having each class in a dedicated file usually plays nice with PSR autoloaders and is therefore a well established practice. If you use other autoloaders, you might not want to follow this rule.