| Conditions | 11 | 
| Paths | 8 | 
| Total Lines | 35 | 
| Code Lines | 22 | 
| 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 | <?  | 
            ||
| 11 | function scan($dir, $durl = '', $min_size = '0')  | 
            ||
| 12 | { | 
            ||
| 13 | static $seen = [];  | 
            ||
| 14 | global $return;  | 
            ||
| 15 | $files = [];  | 
            ||
| 16 | |||
| 17 | $dir = realpath($dir);  | 
            ||
| 18 |     if (isset($seen[$dir])) { | 
            ||
| 19 | return $files;  | 
            ||
| 20 | }  | 
            ||
| 21 | $seen[$dir] = true;  | 
            ||
| 22 | $dh = @opendir($dir);  | 
            ||
| 23 | |||
| 24 |     while ($dh && ($file = readdir($dh))) { | 
            ||
| 25 |         if ('.' !== $file && '..' !== $file) { | 
            ||
| 26 | $path = realpath($dir . '/' . $file);  | 
            ||
| 27 | $url = $durl . '/' . $file;  | 
            ||
| 28 | |||
| 29 |             if (preg_match("/\.svn|lang/", $path)) { | 
            ||
| 30 | continue;  | 
            ||
| 31 | }  | 
            ||
| 32 | |||
| 33 |             if (is_dir($path)) { | 
            ||
| 34 | scan($path);  | 
            ||
| 35 |             } elseif (is_file($path)) { | 
            ||
| 36 |                 if (!preg_match("/\.js$/", $path) || filesize($path) < $min_size) { | 
            ||
| 37 | continue;  | 
            ||
| 38 | }  | 
            ||
| 39 | $return[] = $path;  | 
            ||
| 40 | }  | 
            ||
| 41 | }  | 
            ||
| 42 | }  | 
            ||
| 43 | @closedir($dh);  | 
            ||
| 44 | |||
| 45 | return $files;  | 
            ||
| 46 | }  | 
            ||
| 97 | 
Short opening tags are disabled in PHP?s default configuration. In such a case, all content of this file is output verbatim to the browser without being parsed, or executed.
As a precaution to avoid these problems better use the long opening tag
<?php.