| Conditions | 10 | 
| Paths | 6 | 
| Total Lines | 25 | 
| Code Lines | 16 | 
| 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 namespace Arcanesoft\Foundation\ViewComposers\System;  | 
            ||
| 79 | private function formatSize($bytes)  | 
            ||
| 80 |     { | 
            ||
| 81 | $kb = 1024;  | 
            ||
| 82 | $mb = $kb * 1024;  | 
            ||
| 83 | $gb = $mb * 1024;  | 
            ||
| 84 | $tb = $gb * 1024;  | 
            ||
| 85 | |||
| 86 |         if (($bytes >= 0) && ($bytes < $kb)) { | 
            ||
| 87 | return $bytes . ' B';  | 
            ||
| 88 | }  | 
            ||
| 89 |         elseif (($bytes >= $kb) && ($bytes < $mb)) { | 
            ||
| 90 | return ceil($bytes / $kb).' KB';  | 
            ||
| 91 | }  | 
            ||
| 92 |         elseif (($bytes >= $mb) && ($bytes < $gb)) { | 
            ||
| 93 | return ceil($bytes / $mb).' MB';  | 
            ||
| 94 | }  | 
            ||
| 95 |         elseif (($bytes >= $gb) && ($bytes < $tb)) { | 
            ||
| 96 | return ceil($bytes / $gb).' GB';  | 
            ||
| 97 | }  | 
            ||
| 98 |         elseif ($bytes >= $tb) { | 
            ||
| 99 | return ceil($bytes / $tb).' TB';  | 
            ||
| 100 | }  | 
            ||
| 101 | |||
| 102 | return $bytes.' B';  | 
            ||
| 103 | }  | 
            ||
| 104 | }  | 
            ||
| 105 |