Conditions | 1 |
Paths | 1 |
Total Lines | 85 |
Code Lines | 66 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
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 |
||
115 | public function noAssociationData(): array |
||
116 | { |
||
117 | return [ |
||
118 | 'array' => [ |
||
119 | $array = 'array', |
||
120 | $array, |
||
121 | Guess::HIGH_CONFIDENCE, |
||
122 | ], |
||
123 | 'json' => [ |
||
124 | 'json', |
||
125 | $array, |
||
126 | Guess::HIGH_CONFIDENCE, |
||
127 | ], |
||
128 | 'boolean' => [ |
||
129 | $boolean = 'boolean', |
||
130 | $boolean, |
||
131 | Guess::HIGH_CONFIDENCE, |
||
132 | ], |
||
133 | 'datetime' => [ |
||
134 | $datetime = 'datetime', |
||
135 | $datetime, |
||
136 | Guess::HIGH_CONFIDENCE, |
||
137 | ], |
||
138 | 'vardatetime' => [ |
||
139 | 'vardatetime', |
||
140 | $datetime, |
||
141 | Guess::HIGH_CONFIDENCE, |
||
142 | ], |
||
143 | 'datetimetz' => [ |
||
144 | 'datetimetz', |
||
145 | $datetime, |
||
146 | Guess::HIGH_CONFIDENCE, |
||
147 | ], |
||
148 | 'date' => [ |
||
149 | $date = 'date', |
||
150 | $date, |
||
151 | Guess::HIGH_CONFIDENCE, |
||
152 | ], |
||
153 | 'decimal' => [ |
||
154 | 'decimal', |
||
155 | $number = 'number', |
||
156 | Guess::MEDIUM_CONFIDENCE, |
||
157 | ], |
||
158 | 'float' => [ |
||
159 | 'float', |
||
160 | $number, |
||
161 | Guess::MEDIUM_CONFIDENCE, |
||
162 | ], |
||
163 | 'integer' => [ |
||
164 | $integer = 'integer', |
||
165 | $integer, |
||
166 | Guess::MEDIUM_CONFIDENCE, |
||
167 | ], |
||
168 | 'bigint' => [ |
||
169 | 'bigint', |
||
170 | $integer, |
||
171 | Guess::MEDIUM_CONFIDENCE, |
||
172 | ], |
||
173 | 'smallint' => [ |
||
174 | 'smallint', |
||
175 | $integer, |
||
176 | Guess::MEDIUM_CONFIDENCE, |
||
177 | ], |
||
178 | 'string' => [ |
||
179 | 'string', |
||
180 | $text = 'text', |
||
181 | Guess::MEDIUM_CONFIDENCE, |
||
182 | ], |
||
183 | 'text' => [ |
||
184 | 'text', |
||
185 | 'textarea', |
||
186 | Guess::MEDIUM_CONFIDENCE, |
||
187 | ], |
||
188 | 'time' => [ |
||
189 | $time = 'time', |
||
190 | $time, |
||
191 | Guess::HIGH_CONFIDENCE, |
||
192 | ], |
||
193 | 'somefake' => [ |
||
194 | 'somefake', |
||
195 | $text, |
||
196 | Guess::LOW_CONFIDENCE, |
||
197 | ], |
||
198 | ]; |
||
199 | } |
||
200 | } |
||
201 |