| Conditions | 12 |
| Paths | 16 |
| Total Lines | 24 |
| Code Lines | 20 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 156 |
| 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 |
||
| 34 | } |
||
| 35 | } |
||
| 36 | |||
| 37 | if (file_exists(CORE_DIR)) { |
||
| 38 | $loaded_files = []; |
||
| 39 | //Autoload de módulos |
||
| 40 | $finder = new Finder(); |
||
| 41 | $finder->files()->in(CORE_DIR)->name('autoload.php'); |
||
| 42 | /* @var $file SplFileInfo */ |
||
| 43 | foreach ($finder as $file) { |
||
| 44 | $path = $file->getRealPath(); |
||
| 45 | if (!in_array($path, $loaded_files)) { |
||
| 46 | $loaded_files[] = $path; |
||
| 47 | require_once($path); |
||
| 48 | } |
||
| 49 | } |
||
| 50 | } |
||
| 51 | |||
| 52 | if (!function_exists('t')) { |
||
| 53 | function t($message, $key = null, $reload = false) |
||
| 54 | { |
||
| 55 | 10 | return CustomTranslateExtension::_($message, $key, $reload); |
|
| 56 | } |
||
| 57 | } |
||
| 58 |