| Conditions | 7 | 
| Paths | 6 | 
| Total Lines | 55 | 
| Code Lines | 45 | 
| 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  | 
            ||
| 98 | private static function getExceptionMessage($statusCode, $subCode = null, $field = null)  | 
            ||
| 99 |     { | 
            ||
| 100 | $codes = [  | 
            ||
| 101 | self::STATUS_NO_DATA =>  | 
            ||
| 102 | 'There is no data available (in response to an action that would normally result in returning data). ' .  | 
            ||
| 103 | 'Usually indicates that there is no item with the ID you specified. ' .  | 
            ||
| 104 | 'To resolve the error, change the specified ID to that of an item that exists.',  | 
            ||
| 105 | self::STATUS_TOO_MUCH_DATA => 'The action should have returned a single result but is actually returning ' .  | 
            ||
| 106 | 'multiple results. For example, if there are multiple users with the same user name and password, ' .  | 
            ||
| 107 | 'and you call the login action using that user name and password as parameters, ' .  | 
            ||
| 108 | 'the system cannot determine which user to log you in as, so it returns a too-much-data error.',  | 
            ||
| 109 | self::STATUS_NO_ACCESS => [  | 
            ||
| 110 | 'account-expired' => 'The account has expired.',  | 
            ||
| 111 | 'denied' => 'Based on the supplied credentials, you don’t have permission to call the action.',  | 
            ||
| 112 | 'no-login' => 'The user is not logged in. To resolve the error, log in (using the login action) ' .  | 
            ||
| 113 | 'before you make the call.',  | 
            ||
| 114 | 'illegalparent' => 'The specified acl - id is not a seminar or an unknown issue occured while ' .  | 
            ||
| 115 | 'retrieving the quota for that seminar.',  | 
            ||
| 116 | 'no-quota' => 'The account limits have been reached or exceeded.',  | 
            ||
| 117 | 'not-available' => 'The required resource is unavailable.',  | 
            ||
| 118 | 'not-secure' => 'You must use SSL to call this action.',  | 
            ||
| 119 | 'pending-activation' => 'The account is not yet activated.',  | 
            ||
| 120 | 'pending-license' => 'The account’s license agreement has not been settled.',  | 
            ||
| 121 | 'sco-expired' => 'The course or tracking content has expired.',  | 
            ||
| 122 | 'sco-not-started' => 'The meeting or course has not started.',  | 
            ||
| 123 | 'valuelessthanorequal' => 'Value is not a valid integer or is greater than the allowed license quota ' .  | 
            ||
| 124 | 'for that seminar.',  | 
            ||
| 125 | ],  | 
            ||
| 126 | self::STATUS_INVALID => [  | 
            ||
| 127 | 'duplicate' => 'The call attempted to add a duplicate item on %s in a context where uniqueness is ' .  | 
            ||
| 128 | 'required.',  | 
            ||
| 129 | 'format' => 'passed %s parameter had the wrong format.',  | 
            ||
| 130 | 'illegal-operation' => 'The requested operation on %s violates integrity rules ' .  | 
            ||
| 131 | '(for example, moving a folder into itself).',  | 
            ||
| 132 | 'missing' => 'A required parameter %s is missing.',  | 
            ||
| 133 | 'no-such-item' => 'The requested %s does not exist.',  | 
            ||
| 134 | 'range' => 'The value of %s is outside the permitted range of values.'  | 
            ||
| 135 | ]  | 
            ||
| 136 | ];  | 
            ||
| 137 | |||
| 138 | //this statement will check for any unknown subcodes if any subcodes provided  | 
            ||
| 139 | // and if any unknown provided, it'll return default error message!  | 
            ||
| 140 |         if ($subCode && !isset($codes[$statusCode][$subCode])) { | 
            ||
| 141 |             return "{$statusCode} - {$subCode} - {$field}"; | 
            ||
| 142 | }  | 
            ||
| 143 | |||
| 144 |         switch ($statusCode) { | 
            ||
| 145 | case self::STATUS_INVALID:  | 
            ||
| 146 | return sprintf($codes[self::STATUS_INVALID][$subCode], $field);  | 
            ||
| 147 | case self::STATUS_NO_ACCESS:  | 
            ||
| 148 | return $codes[self::STATUS_NO_ACCESS][$subCode];  | 
            ||
| 149 | case self::STATUS_NO_DATA:  | 
            ||
| 150 | return $codes[self::STATUS_NO_DATA];  | 
            ||
| 151 | case self::STATUS_TOO_MUCH_DATA:  | 
            ||
| 152 | return $codes[self::STATUS_TOO_MUCH_DATA];  | 
            ||
| 153 | }  | 
            ||
| 156 |