Conditions | 2 |
Paths | 2 |
Total Lines | 76 |
Code Lines | 71 |
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 |
||
64 | private function getKeywords() |
||
65 | { |
||
66 | if (\PHP_VERSION_ID >= 70000) { |
||
67 | return array('__halt_compiler'); |
||
68 | } |
||
69 | |||
70 | return array( |
||
71 | '__halt_compiler', |
||
72 | 'abstract', |
||
73 | 'and', |
||
74 | 'array', |
||
75 | 'as', |
||
76 | 'break', |
||
77 | 'callable', |
||
78 | 'case', |
||
79 | 'catch', |
||
80 | 'class', |
||
81 | 'clone', |
||
82 | 'const', |
||
83 | 'continue', |
||
84 | 'declare', |
||
85 | 'default', |
||
86 | 'die', |
||
87 | 'do', |
||
88 | 'echo', |
||
89 | 'else', |
||
90 | 'elseif', |
||
91 | 'empty', |
||
92 | 'enddeclare', |
||
93 | 'endfor', |
||
94 | 'endforeach', |
||
95 | 'endif', |
||
96 | 'endswitch', |
||
97 | 'endwhile', |
||
98 | 'eval', |
||
99 | 'exit', |
||
100 | 'extends', |
||
101 | 'final', |
||
102 | 'finally', |
||
103 | 'for', |
||
104 | 'foreach', |
||
105 | 'function', |
||
106 | 'global', |
||
107 | 'goto', |
||
108 | 'if', |
||
109 | 'implements', |
||
110 | 'include', |
||
111 | 'include_once', |
||
112 | 'instanceof', |
||
113 | 'insteadof', |
||
114 | 'interface', |
||
115 | 'isset', |
||
116 | 'list', |
||
117 | 'namespace', |
||
118 | 'new', |
||
119 | 'or', |
||
120 | 'print', |
||
121 | 'private', |
||
122 | 'protected', |
||
123 | 'public', |
||
124 | 'require', |
||
125 | 'require_once', |
||
126 | 'return', |
||
127 | 'static', |
||
128 | 'switch', |
||
129 | 'throw', |
||
130 | 'trait', |
||
131 | 'try', |
||
132 | 'unset', |
||
133 | 'use', |
||
134 | 'var', |
||
135 | 'while', |
||
136 | 'xor', |
||
137 | 'yield', |
||
138 | ); |
||
139 | } |
||
140 | } |
||
141 |