| Conditions | 8 |
| Paths | 8 |
| Total Lines | 26 |
| Code Lines | 24 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 61 | private static function jsonLastErrorMsg(){ |
||
| 62 | if(function_exists('json_last_error_msg')) return json_last_error_msg(); |
||
| 63 | switch (json_last_error()) { |
||
| 64 | case JSON_ERROR_NONE: |
||
| 65 | return ' - No errors'; |
||
| 66 | break; |
||
| 67 | case JSON_ERROR_DEPTH: |
||
| 68 | return ' - Maximum stack depth exceeded'; |
||
| 69 | break; |
||
| 70 | case JSON_ERROR_STATE_MISMATCH: |
||
| 71 | return ' - Underflow or the modes mismatch'; |
||
| 72 | break; |
||
| 73 | case JSON_ERROR_CTRL_CHAR: |
||
| 74 | return ' - Unexpected control character found'; |
||
| 75 | break; |
||
| 76 | case JSON_ERROR_SYNTAX: |
||
| 77 | return ' - Syntax error, malformed JSON'; |
||
| 78 | break; |
||
| 79 | case JSON_ERROR_UTF8: |
||
| 80 | return ' - Malformed UTF-8 characters, possibly incorrectly encoded'; |
||
| 81 | break; |
||
| 82 | default: |
||
| 83 | return ' - Unknown error'; |
||
| 84 | break; |
||
| 85 | } |
||
| 86 | } |
||
| 87 | } |
||
| 89 |
This check looks for methods that are used by a trait but not required by it.
To illustrate, let’s look at the following code example
The trait
Idableprovides a methodequalsIdthat in turn relies on the methodgetId(). If this method does not exist on a class mixing in this trait, the method will fail.Adding the
getId()as an abstract method to the trait will make sure it is available.