| Conditions | 10 | 
| Paths | 8 | 
| Total Lines | 35 | 
| Code Lines | 24 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 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  | 
            ||
| 33 | 	public function doFind($script) { | 
            ||
| 34 | $themeDirectory = $this->theme->getDirectory();  | 
            ||
| 35 | |||
| 36 | 		if (strpos($script, '/l10n/') !== false) { | 
            ||
| 37 | // For language files we try to load them all, so themes can overwrite  | 
            ||
| 38 | // single l10n strings without having to translate all of them.  | 
            ||
| 39 | $found = 0;  | 
            ||
| 40 | $found += $this->appendOnceIfExist($this->serverroot, 'core/'.$script.'.js');  | 
            ||
| 41 | $found += $this->appendOnceIfExist($this->serverroot, $themeDirectory.'/core/'.$script.'.js');  | 
            ||
| 42 | $found += $this->appendOnceIfExist($this->serverroot, $script.'.js');  | 
            ||
| 43 | $found += $this->appendOnceIfExist($this->serverroot, $themeDirectory.'/'.$script.'.js');  | 
            ||
| 44 | $found += $this->appendOnceIfExist($this->serverroot, $themeDirectory.'/apps/'.$script.'.js');  | 
            ||
| 45 | |||
| 46 | 			if ($found) { | 
            ||
| 47 | return;  | 
            ||
| 48 | }  | 
            ||
| 49 | } else if ($this->appendOnceIfExist($this->serverroot, $themeDirectory.'/apps/'.$script.'.js')  | 
            ||
| 50 | || $this->appendOnceIfExist($this->serverroot, $themeDirectory.'/'.$script.'.js')  | 
            ||
| 51 | || $this->appendOnceIfExist($this->serverroot, $script.'.js')  | 
            ||
| 52 | || $this->appendOnceIfExist($this->serverroot, $themeDirectory.'/core/'.$script.'.js')  | 
            ||
| 53 | || $this->appendOnceIfExist($this->serverroot, 'core/'.$script.'.js')  | 
            ||
| 54 | 		) { | 
            ||
| 55 | return;  | 
            ||
| 56 | }  | 
            ||
| 57 | |||
| 58 | $app = substr($script, 0, strpos($script, '/'));  | 
            ||
| 59 | $script = substr($script, strpos($script, '/')+1);  | 
            ||
| 60 | $app_path = \OC_App::getAppPath($app);  | 
            ||
| 61 | 		if( $app_path === false ) { return; } | 
            ||
| 62 | $app_url = \OC_App::getAppWebPath($app);  | 
            ||
| 63 | $app_url = ($app_url !== false) ? $app_url : null;  | 
            ||
| 64 | |||
| 65 | // missing translations files fill be ignored  | 
            ||
| 66 | $this->appendOnceIfExist($app_path, $script . '.js', $app_url);  | 
            ||
| 67 | }  | 
            ||
| 68 | |||
| 75 |