| Conditions | 10 |
| Paths | 7 |
| Total Lines | 25 |
| Code Lines | 17 |
| 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 |
||
| 38 | public static function checkFormatSupport($format) |
||
| 39 | { |
||
| 40 | if (!static::isInstalled()) { |
||
| 41 | return []; |
||
| 42 | } |
||
| 43 | |||
| 44 | if ( |
||
| 45 | ($format === Formats::TAR_BZIP && !extension_loaded('bzip2')) |
||
| 46 | || ($format === Formats::TAR_GZIP && !extension_loaded('zlib')) |
||
| 47 | ) { |
||
| 48 | return []; |
||
| 49 | } |
||
| 50 | |||
| 51 | switch ($format) { |
||
| 52 | case Formats::ZIP: |
||
| 53 | case Formats::TAR: |
||
| 54 | case Formats::TAR_GZIP; |
||
| 55 | case Formats::TAR_BZIP; |
||
| 56 | return [ |
||
| 57 | BasicDriver::OPEN, |
||
| 58 | // BasicDriver::EXTRACT_CONTENT, |
||
| 59 | BasicDriver::APPEND, |
||
| 60 | BasicDriver::CREATE, |
||
| 61 | BasicDriver::CREATE_ENCRYPTED, |
||
| 62 | BasicDriver::CREATE_IN_STRING, |
||
| 63 | ]; |
||
| 131 |