| Conditions | 11 |
| Paths | 11 |
| Total Lines | 42 |
| Code Lines | 21 |
| 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 |
||
| 86 | private function scopeMap( $scope ) |
||
| 87 | { |
||
| 88 | switch ( $scope ) { |
||
| 89 | case 'all': |
||
| 90 | { |
||
| 91 | return Google_Service_Gmail::MAIL_GOOGLE_COM; |
||
| 92 | } |
||
| 93 | case 'compose': |
||
| 94 | { |
||
| 95 | return Google_Service_Gmail::GMAIL_COMPOSE; |
||
| 96 | } |
||
| 97 | case 'insert': |
||
| 98 | { |
||
| 99 | return Google_Service_Gmail::GMAIL_INSERT; |
||
| 100 | } |
||
| 101 | case 'labels': |
||
| 102 | { |
||
| 103 | return Google_Service_Gmail::GMAIL_LABELS; |
||
| 104 | } |
||
| 105 | case 'metadata': |
||
| 106 | { |
||
| 107 | return Google_Service_Gmail::GMAIL_METADATA; |
||
| 108 | } |
||
| 109 | case 'modify': |
||
| 110 | { |
||
| 111 | return Google_Service_Gmail::GMAIL_MODIFY; |
||
| 112 | } |
||
| 113 | case 'readonly': |
||
| 114 | { |
||
| 115 | return Google_Service_Gmail::GMAIL_READONLY; |
||
| 116 | } |
||
| 117 | case 'send': |
||
| 118 | { |
||
| 119 | return Google_Service_Gmail::GMAIL_SEND; |
||
| 120 | } |
||
| 121 | case 'settings_basic': |
||
| 122 | { |
||
| 123 | return Google_Service_Gmail::GMAIL_SETTINGS_BASIC; |
||
| 124 | } |
||
| 125 | case 'settings_sharing': |
||
| 126 | { |
||
| 127 | return Google_Service_Gmail::GMAIL_SETTINGS_SHARING; |
||
| 128 | } |
||
| 132 | } |