| Conditions | 27 |
| Paths | 42 |
| Total Lines | 126 |
| Code Lines | 57 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 4 | ||
| Bugs | 1 | 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 |
||
| 177 | * |
||
| 178 | * @param string $from |
||
| 179 | * @param string $to |
||
| 180 | * |
||
| 181 | * @return array |
||
| 182 | */ |
||
| 183 | function getFilesChanged($from, $to) |
||
| 184 | { |
||
| 185 | global $settings; |
||
| 186 | |||
| 187 | echo 'Running Command: git diff --name-only --pretty=oneline --full-index ElkArte/' . $from . '..ElkArte/' . $to . ' | sort | uniq<br>'; |
||
| 188 | |||
| 189 | $output = shell_exec('git diff --name-only --pretty=oneline --full-index ElkArte/' . $from . '..ElkArte/' . $to . ' | sort | uniq'); |
||
| 190 | if (empty($output)) |
||
| 191 | { |
||
| 192 | echo "The git command failed to return any results\n"; |
||
| 193 | //die; |
||
| 194 | } |
||
| 195 | |||
| 196 | $dirs = array( |
||
| 197 | str_replace(BOARDDIR . '/', '', SOURCEDIR . '/database/') => 'database', |
||
| 198 | str_replace(BOARDDIR . '/', '', SUBSDIR . '/') => 'subs', |
||
| 199 | str_replace(BOARDDIR . '/', '', CONTROLLERDIR . '/') => 'controllers', |
||
| 200 | str_replace(BOARDDIR . '/', '', SOURCEDIR . '/') => 'sources', |
||
| 201 | str_replace(BOARDDIR . '/', '', ADMINDIR . '/') => 'admin', |
||
| 202 | str_replace(BOARDDIR . '/', '', ADMINDIR . '/') => 'admin', |
||
| 203 | str_replace(BOARDDIR . '/', '', $settings['theme_dir'] . '/') => 'default', |
||
| 204 | ); |
||
| 205 | |||
| 206 | $files = array_filter(explode("\n", $output)); |
||
| 207 | $list = array(); |
||
| 208 | foreach ($files as $file) |
||
| 209 | { |
||
| 210 | if ($file[0] === '.') |
||
| 211 | { |
||
| 212 | continue; |
||
| 213 | } |
||
| 214 | |||
| 215 | if (strpos($file, 'README') !== false) |
||
| 216 | { |
||
| 217 | continue; |
||
| 218 | } |
||
| 219 | |||
| 220 | if (strpos($file, 'install') !== false) |
||
| 221 | { |
||
| 222 | continue; |
||
| 223 | } |
||
| 224 | |||
| 225 | if (strpos($file, 'release_tools') !== false) |
||
| 226 | { |
||
| 227 | continue; |
||
| 228 | } |
||
| 229 | |||
| 230 | if (strpos($file, '/ext') !== false) |
||
| 231 | { |
||
| 232 | continue; |
||
| 233 | } |
||
| 234 | |||
| 235 | if (strpos($file, 'tests') !== false) |
||
| 236 | { |
||
| 237 | continue; |
||
| 238 | } |
||
| 239 | |||
| 240 | if (strpos($file, 'fonts') !== false) |
||
| 241 | { |
||
| 242 | continue; |
||
| 243 | } |
||
| 244 | |||
| 245 | if (strpos($file, '/scripts') !== false) |
||
| 246 | { |
||
| 247 | continue; |
||
| 248 | } |
||
| 249 | |||
| 250 | if (strpos($file, 'docs/') !== false) |
||
| 251 | { |
||
| 252 | continue; |
||
| 253 | } |
||
| 254 | |||
| 255 | if (strpos($file, '/images') !== false) |
||
| 256 | { |
||
| 257 | continue; |
||
| 258 | } |
||
| 259 | |||
| 260 | if (strpos($file, '/css') !== false) |
||
| 261 | { |
||
| 262 | continue; |
||
| 263 | } |
||
| 264 | |||
| 265 | if (strpos($file, '/languages') !== false) |
||
| 266 | { |
||
| 267 | continue; |
||
| 268 | } |
||
| 269 | |||
| 270 | if (strpos($file, 'packages') !== false) |
||
| 271 | { |
||
| 272 | continue; |
||
| 273 | } |
||
| 274 | |||
| 275 | if (strpos($file, '.txt') !== false || strpos($file, '.json') !== false) |
||
| 276 | { |
||
| 277 | continue; |
||
| 278 | } |
||
| 279 | |||
| 280 | if ($file === 'index.php') |
||
| 281 | { |
||
| 282 | continue; |
||
| 283 | } |
||
| 284 | |||
| 285 | if ($file === 'ssi_examples.php') |
||
| 286 | { |
||
| 287 | continue; |
||
| 288 | } |
||
| 289 | |||
| 290 | if ($file === 'ssi_examples.shtml') |
||
| 291 | { |
||
| 292 | continue; |
||
| 293 | } |
||
| 294 | |||
| 295 | if ($file === 'elkServiceWorker.min.js') |
||
| 296 | { |
||
| 297 | continue; |
||
| 298 | } |
||
| 299 | |||
| 300 | if ($file === 'SSI.php') |
||
| 301 | { |
||
| 302 | $list[] = 'sourcesSSI.php'; |
||
| 303 | continue; |
||
| 319 |