|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace RealPage\JsonApi\Requests; |
|
4
|
|
|
|
|
5
|
|
|
use Neomerx\JsonApi\Contracts\Document\ErrorInterface; |
|
6
|
|
|
|
|
7
|
|
|
class MalformedRequest implements ErrorInterface |
|
8
|
|
|
{ |
|
9
|
|
|
/** |
|
10
|
|
|
* Get a unique identifier for this particular occurrence of the problem. |
|
11
|
|
|
* |
|
12
|
|
|
* @return int|string|null |
|
13
|
|
|
*/ |
|
14
|
|
|
public function getId() |
|
15
|
|
|
{ |
|
16
|
|
|
} |
|
17
|
|
|
|
|
18
|
|
|
/** |
|
19
|
|
|
* Get links that may lead to further details about this particular occurrence of the problem. |
|
20
|
|
|
* |
|
21
|
|
|
* @return null|array<string,\Neomerx\JsonApi\Contracts\Schema\LinkInterface> |
|
22
|
|
|
*/ |
|
23
|
|
|
public function getLinks() |
|
24
|
|
|
{ |
|
25
|
|
|
} |
|
26
|
|
|
|
|
27
|
|
|
/** |
|
28
|
|
|
* Get the HTTP status code applicable to this problem, expressed as a string value. |
|
29
|
|
|
* |
|
30
|
|
|
* @return string|null |
|
31
|
|
|
*/ |
|
32
|
|
|
public function getStatus() |
|
33
|
|
|
{ |
|
34
|
|
|
return 400; // bad request |
|
35
|
|
|
} |
|
36
|
|
|
|
|
37
|
|
|
/** |
|
38
|
|
|
* Get an application-specific error code, expressed as a string value. |
|
39
|
|
|
* |
|
40
|
|
|
* @return string|null |
|
41
|
|
|
*/ |
|
42
|
|
|
public function getCode() |
|
43
|
|
|
{ |
|
44
|
|
|
} |
|
45
|
|
|
|
|
46
|
|
|
/** |
|
47
|
|
|
* Get a short, human-readable summary of the problem. |
|
48
|
|
|
* |
|
49
|
|
|
* It should not change from occurrence to occurrence of the problem, except for purposes of localization. |
|
50
|
|
|
* |
|
51
|
|
|
* @return string|null |
|
52
|
|
|
*/ |
|
53
|
|
|
public function getTitle() |
|
54
|
|
|
{ |
|
55
|
|
|
return 'Request json malformed'; |
|
56
|
|
|
} |
|
57
|
|
|
|
|
58
|
|
|
/** |
|
59
|
|
|
* Get a human-readable explanation specific to this occurrence of the problem. |
|
60
|
|
|
* |
|
61
|
|
|
* @return string|null |
|
62
|
|
|
*/ |
|
63
|
|
|
public function getDetail() |
|
64
|
|
|
{ |
|
65
|
|
|
return 'The request json is malformed and could not be parsed.'; |
|
66
|
|
|
} |
|
67
|
|
|
|
|
68
|
|
|
/** |
|
69
|
|
|
* An object containing references to the source of the error, optionally including any of the following members: |
|
70
|
|
|
* "pointer" - A JSON Pointer [RFC6901] to the associated entity in the request document |
|
71
|
|
|
* [e.g. "/data" for a primary data object, or "/data/attributes/title" for a specific attribute]. |
|
72
|
|
|
* "parameter" - An optional string indicating which query parameter caused the error. |
|
73
|
|
|
* |
|
74
|
|
|
* @return array|null |
|
75
|
|
|
*/ |
|
76
|
|
|
public function getSource() |
|
77
|
|
|
{ |
|
78
|
|
|
} |
|
79
|
|
|
|
|
80
|
|
|
/** |
|
81
|
|
|
* Get error meta information. |
|
82
|
|
|
* |
|
83
|
|
|
* @return array|null |
|
84
|
|
|
*/ |
|
85
|
|
|
public function getMeta() |
|
86
|
|
|
{ |
|
87
|
|
|
} |
|
88
|
|
|
} |
|
89
|
|
|
|