| Conditions | 10 |
| Paths | 5 |
| Total Lines | 21 |
| Code Lines | 13 |
| 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 // content="text/plain; charset=utf-8" |
||
| 35 | public function GetFiles() |
||
| 36 | { |
||
| 37 | $d = @dir($this->iDir); |
||
| 38 | $a = array(); |
||
| 39 | while ($entry = $d->Read()) { |
||
| 40 | //echo $entry . ':' . (is_dir($entry) ? 'folder' : 'file') . '<br>'; |
||
| 41 | if (is_dir($entry) && ($entry == "examples_pie")) { |
||
| 42 | $examplefolder = @dir($entry); |
||
| 43 | while ($file = $examplefolder->Read()) { |
||
| 44 | if (strstr($file, ".php") && strstr($file, "x") && !strstr($file, "show") && !strstr($file, "csim")) { |
||
| 45 | $a[] = $entry . '/' . $file; |
||
| 46 | } |
||
| 47 | } |
||
| 48 | } |
||
| 49 | } |
||
| 50 | $d->Close(); |
||
| 51 | if (count($a) == 0) { |
||
| 52 | die("PANIC: Apache/PHP does not have enough permission to read the scripts in directory: $this->iDir"); |
||
| 53 | } |
||
| 54 | sort($a); |
||
| 55 | return $a; |
||
| 56 | } |
||
| 114 |