Conditions | 7 |
Paths | 7 |
Total Lines | 18 |
Lines | 18 |
Ratio | 100 % |
Changes | 0 |
1 | <?php |
||
34 | protected function getErrorMessageByErrorCode($httpCode) { |
||
35 | switch($httpCode) { |
||
36 | case 400: |
||
37 | return 'The recipient identity is invalid or the account is not set up for simple mode'; |
||
38 | case 401: |
||
39 | return 'API identity or secret incorrect'; |
||
40 | case 402: |
||
41 | return 'No credits remain'; |
||
42 | case 404: |
||
43 | return 'Phone or email could not be found'; |
||
44 | case 413: |
||
45 | return 'Message is too long'; |
||
46 | case 500: |
||
47 | return 'A temporary internal server error has occurred'; |
||
48 | default: |
||
49 | return 'Unknown error'; |
||
50 | } |
||
51 | } |
||
52 | } |
||
53 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.