| Conditions | 10 | 
| Paths | 28 | 
| Total Lines | 56 | 
| Code Lines | 27 | 
| 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 | public function load($file_name, $fatal = true, $fix_calendar_arrays = false)  | 
            ||
| 65 | 	{ | 
            ||
| 66 | global $db_show_debug;  | 
            ||
| 67 | |||
| 68 | 		$file_names = explode('+', $file_name); | 
            ||
| 69 | |||
| 70 | // For each file open it up and write it out!  | 
            ||
| 71 | foreach ($file_names as $file)  | 
            ||
| 72 | 		{ | 
            ||
| 73 | $file = ucfirst($file);  | 
            ||
| 74 | if (isset($this->loaded[$file]))  | 
            ||
| 75 | 			{ | 
            ||
| 76 | continue;  | 
            ||
| 77 | }  | 
            ||
| 78 | |||
| 79 | $found = false;  | 
            ||
| 
                                                                                                    
                        
                         | 
                |||
| 80 | $found_fallback = false;  | 
            ||
| 81 | if ($this->load_fallback)  | 
            ||
| 82 | 			{ | 
            ||
| 83 | $found_fallback = $this->loadFile($file, 'English');  | 
            ||
| 84 | }  | 
            ||
| 85 | $found = $this->loadFile($file, $this->language);  | 
            ||
| 86 | |||
| 87 | $this->loaded[$file] = true;  | 
            ||
| 88 | |||
| 89 | // Keep track of what we're up to, soldier.  | 
            ||
| 90 | if ($found && $db_show_debug === true)  | 
            ||
| 91 | 			{ | 
            ||
| 92 | Debug::instance()->add(  | 
            ||
| 93 | 'language_files',  | 
            ||
| 94 | $file . '.' . $this->language .  | 
            ||
| 95 | 					' (' . str_replace(BOARDDIR, '', $this->path) . ')' | 
            ||
| 96 | );  | 
            ||
| 97 | }  | 
            ||
| 98 | |||
| 99 | // That couldn't be found! Log the error, but *try* to continue normally.  | 
            ||
| 100 | if (!$found && $fatal)  | 
            ||
| 101 | 			{ | 
            ||
| 102 | Errors::instance()->log_error(  | 
            ||
| 103 | sprintf(  | 
            ||
| 104 | $txt['theme_language_error'],  | 
            ||
| 105 | $file . '.' . $this->language,  | 
            ||
| 106 | 'template'  | 
            ||
| 107 | )  | 
            ||
| 108 | );  | 
            ||
| 109 | // If we do have a fallback it may not be necessary to break out.  | 
            ||
| 110 | if ($found_fallback === false)  | 
            ||
| 111 | 				{ | 
            ||
| 112 | break;  | 
            ||
| 113 | }  | 
            ||
| 114 | }  | 
            ||
| 115 | }  | 
            ||
| 116 | |||
| 117 | if ($fix_calendar_arrays)  | 
            ||
| 118 | 		{ | 
            ||
| 119 | $this->fix_calendar_text();  | 
            ||
| 120 | }  | 
            ||
| 217 | }  |