| Conditions | 10 |
| Paths | 8 |
| Total Lines | 44 |
| Code Lines | 28 |
| 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 |
||
| 64 | return true; |
||
| 65 | } else { |
||
| 66 | $output->writeln('<error>' . $which . ' path "' . $path . '" could not be created.</error>'); |
||
| 67 | |||
| 68 | return false; |
||
| 69 | } |
||
| 70 | } |
||
| 71 | |||
| 72 | $readable = is_readable($path); |
||
| 73 | $writable = is_writable($path); |
||
| 74 | if ($readable && $writable) { |
||
| 75 | $output->writeln( |
||
| 76 | 'Creation of ' . $which . ' path "' . $path . '" skipped - path exists with correct permissions' |
||
| 77 | ); |
||
| 78 | |||
| 79 | return true; |
||
| 80 | } elseif (!$readable && !$writable) { |
||
| 81 | $output->writeln( |
||
| 82 | '<error>Creation of ' . $which . ' path "' . $path . '" failed - path exists but is neither readable nor writable</error>' |
||
| 83 | ); |
||
| 84 | } elseif (!$readable) { |
||
| 85 | $output->writeln( |
||
| 86 | '<error>Creation of ' . $which . ' path "' . $path . '" failed - path exists but is not readable</error>' |
||
| 87 | ); |
||
| 88 | } else { |
||
| 89 | $output->writeln( |
||
| 90 | '<error>Creation of ' . $which . ' path "' . $path . '" failed - path exists but is not writable</error>' |
||
| 91 | ); |
||
| 92 | } |
||
| 93 | |||
| 94 | return false; |
||
| 95 | } |
||
| 96 | |||
| 97 | } |
||
| 98 |