Conditions | 1 |
Paths | 1 |
Total Lines | 81 |
Code Lines | 4 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | 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 |
||
28 | private function getIntrospectionQuery() |
||
29 | { |
||
30 | return <<<TEXT |
||
31 | query IntrospectionQuery { |
||
32 | __schema { |
||
33 | queryType { name } |
||
34 | mutationType { name } |
||
35 | types { |
||
36 | ...FullType |
||
37 | } |
||
38 | directives { |
||
39 | name |
||
40 | description |
||
41 | args { |
||
42 | ...InputValue |
||
43 | } |
||
44 | onOperation |
||
45 | onFragment |
||
46 | onField |
||
47 | } |
||
48 | } |
||
49 | } |
||
50 | |||
51 | fragment FullType on __Type { |
||
52 | kind |
||
53 | name |
||
54 | description |
||
55 | fields { |
||
56 | name |
||
57 | description |
||
58 | args { |
||
59 | ...InputValue |
||
60 | } |
||
61 | type { |
||
62 | ...TypeRef |
||
63 | } |
||
64 | isDeprecated |
||
65 | deprecationReason |
||
66 | } |
||
67 | inputFields { |
||
68 | ...InputValue |
||
69 | } |
||
70 | interfaces { |
||
71 | ...TypeRef |
||
72 | } |
||
73 | enumValues { |
||
74 | name |
||
75 | description |
||
76 | isDeprecated |
||
77 | deprecationReason |
||
78 | } |
||
79 | possibleTypes { |
||
80 | ...TypeRef |
||
81 | } |
||
82 | } |
||
83 | |||
84 | fragment InputValue on __InputValue { |
||
85 | name |
||
86 | description |
||
87 | type { ...TypeRef } |
||
88 | defaultValue |
||
89 | } |
||
90 | |||
91 | fragment TypeRef on __Type { |
||
92 | kind |
||
93 | name |
||
94 | ofType { |
||
95 | kind |
||
96 | name |
||
97 | ofType { |
||
98 | kind |
||
99 | name |
||
100 | ofType { |
||
101 | kind |
||
102 | name |
||
103 | } |
||
104 | } |
||
105 | } |
||
106 | } |
||
107 | TEXT; |
||
108 | } |
||
109 | } |