Subversion-Projekte lars-tiefland.laravel_shop

Revision

Revision 148 | Ganze Datei anzeigen | Leerzeichen ignorieren | Details | Blame | Letzte Änderung | Log anzeigen | RSS feed

Revision 148 Revision 621
Zeile 28... Zeile 28...
28
    public static function determineJsonError(string $error, string $prefix = ''): ?string
28
    public static function determineJsonError(string $error, string $prefix = ''): ?string
29
    {
29
    {
30
        switch ($error) {
30
        switch ($error) {
31
            case JSON_ERROR_NONE:
31
            case JSON_ERROR_NONE:
32
                return null;
32
                return null;
-
 
33
 
33
            case JSON_ERROR_DEPTH:
34
            case JSON_ERROR_DEPTH:
34
                return $prefix . 'Maximum stack depth exceeded';
35
                return $prefix . 'Maximum stack depth exceeded';
-
 
36
 
35
            case JSON_ERROR_STATE_MISMATCH:
37
            case JSON_ERROR_STATE_MISMATCH:
36
                return $prefix . 'Underflow or the modes mismatch';
38
                return $prefix . 'Underflow or the modes mismatch';
-
 
39
 
37
            case JSON_ERROR_CTRL_CHAR:
40
            case JSON_ERROR_CTRL_CHAR:
38
                return $prefix . 'Unexpected control character found';
41
                return $prefix . 'Unexpected control character found';
-
 
42
 
39
            case JSON_ERROR_SYNTAX:
43
            case JSON_ERROR_SYNTAX:
40
                return $prefix . 'Syntax error, malformed JSON';
44
                return $prefix . 'Syntax error, malformed JSON';
-
 
45
 
41
            case JSON_ERROR_UTF8:
46
            case JSON_ERROR_UTF8:
42
                return $prefix . 'Malformed UTF-8 characters, possibly incorrectly encoded';
47
                return $prefix . 'Malformed UTF-8 characters, possibly incorrectly encoded';
Zeile 43... Zeile 48...
43
 
48
 
44
            default:
49
            default:
Zeile 54... Zeile 59...
54
        switch (strtolower($type)) {
59
        switch (strtolower($type)) {
55
            case 'expected':
60
            case 'expected':
56
                $prefix = 'Expected value JSON decode error - ';
61
                $prefix = 'Expected value JSON decode error - ';
Zeile 57... Zeile 62...
57
 
62
 
-
 
63
                break;
58
                break;
64
 
59
            case 'actual':
65
            case 'actual':
Zeile 60... Zeile 66...
60
                $prefix = 'Actual value JSON decode error - ';
66
                $prefix = 'Actual value JSON decode error - ';