Completed
Pull Request — master (#26)
by
unknown
13:38
created

MalformedRequest::getStatus()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 1
cts 1
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 1
1
<?php
2
3
namespace RealPage\JsonApi\Requests;
4
5
use Neomerx\JsonApi\Contracts\Schema\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 3
    public function getId()
15
    {
16 3
    }
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 3
    public function getLinks(): ?iterable
24
    {
25 3
        return null;
26
    }
27
28
    /**
29
     * Get type links
30
     *
31
     * @return null|iterable
32 3
     */
33
    public function getTypeLinks(): ?iterable
34 3
    {
35
        return null;
36
    }
37
38
    /**
39
     * Get the HTTP status code applicable to this problem, expressed as a string value.
40
     *
41
     * @return string|null
42 3
     */
43
    public function getStatus(): string
44 3
    {
45
        return 400; // bad request
46
    }
47
48
    /**
49
     * Get an application-specific error code, expressed as a string value.
50
     *
51
     * @return string|null
52
     */
53 3
    public function getCode(): ?string
54
    {
55 3
        return null;
56
    }
57
58
    /**
59
     * Get a short, human-readable summary of the problem.
60
     *
61
     * It should not change from occurrence to occurrence of the problem, except for purposes of localization.
62
     *
63 3
     * @return string|null
64
     */
65 3
    public function getTitle(): string
66
    {
67
        return 'Request json malformed';
68
    }
69
70
    /**
71
     * Get a human-readable explanation specific to this occurrence of the problem.
72
     *
73
     * @return string|null
74
     */
75
    public function getDetail(): string
76 3
    {
77
        return 'The request json is malformed and could not be parsed.';
78 3
    }
79
80
    /**
81
     * An object containing references to the source of the error, optionally including any of the following members:
82
     *    "pointer"   - A JSON Pointer [RFC6901] to the associated entity in the request document
83
     *                  [e.g. "/data" for a primary data object, or "/data/attributes/title" for a specific attribute].
84
     *    "parameter" - An optional string indicating which query parameter caused the error.
85 3
     *
86
     * @return array|null
87 3
     */
88
    public function getSource(): ?array
89
    {
90
        return null;
91
    }
92
93
    /**
94
     * Get has meta
95
     *
96
     * @return bool
97
     */
98
    public function hasMeta(): bool
99
    {
100
        return false;
101
    }
102
103
    /**
104
     * Get error meta information.
105
     *
106
     * @return array|null
107
     */
108
    public function getMeta()
109
    {
110
        return null;
111
    }
112
}
113