1
|
|
|
<?php |
2
|
|
|
namespace LunixREST\Server\Router\Endpoint; |
3
|
|
|
|
4
|
|
|
use LunixREST\Server\Router\Endpoint\Exceptions\ElementConflictException; |
5
|
|
|
use LunixREST\Server\Router\Endpoint\Exceptions\ElementNotFoundException; |
6
|
|
|
use LunixREST\Server\Router\Endpoint\Exceptions\InvalidRequestException; |
7
|
|
|
use LunixREST\Server\Router\Endpoint\Exceptions\UnsupportedMethodException; |
8
|
|
|
use LunixREST\Server\APIRequest\APIRequest; |
9
|
|
|
use LunixREST\Server\APIResponse\APIResponseData; |
10
|
|
|
|
11
|
|
|
/** |
12
|
|
|
* An Endpoint that throws UnsupportedMethodException for all requests. |
13
|
|
|
* Class Endpoint |
14
|
|
|
* @package LunixREST\Server\Router\Endpoint |
15
|
|
|
*/ |
16
|
|
|
class DefaultEndpoint implements Endpoint |
17
|
|
|
{ |
18
|
|
|
/** |
19
|
|
|
* @param APIRequest $request |
20
|
|
|
* @return APIResponseData |
21
|
|
|
* @throws UnsupportedMethodException |
22
|
|
|
* @throws ElementNotFoundException |
23
|
|
|
* @throws InvalidRequestException |
24
|
|
|
*/ |
25
|
1 |
|
public function get(APIRequest $request): APIResponseData |
26
|
|
|
{ |
27
|
1 |
|
throw new UnsupportedMethodException('Method not supported'); |
28
|
|
|
} |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* @param APIRequest $request |
32
|
|
|
* @return APIResponseData |
33
|
|
|
* @throws UnsupportedMethodException |
34
|
|
|
* @throws InvalidRequestException |
35
|
|
|
*/ |
36
|
1 |
|
public function getAll(APIRequest $request): APIResponseData |
37
|
|
|
{ |
38
|
1 |
|
throw new UnsupportedMethodException('Method not supported'); |
39
|
|
|
} |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* @param APIRequest $request |
43
|
|
|
* @return APIResponseData |
44
|
|
|
* @throws UnsupportedMethodException |
45
|
|
|
* @throws ElementNotFoundException |
46
|
|
|
* @throws InvalidRequestException |
47
|
|
|
* @throws ElementConflictException |
48
|
|
|
*/ |
49
|
1 |
|
public function post(APIRequest $request): APIResponseData |
50
|
|
|
{ |
51
|
1 |
|
throw new UnsupportedMethodException('Method not supported'); |
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
/** |
55
|
|
|
* @param APIRequest $request |
56
|
|
|
* @return APIResponseData |
57
|
|
|
* @throws UnsupportedMethodException |
58
|
|
|
* @throws InvalidRequestException |
59
|
|
|
* @throws ElementConflictException |
60
|
|
|
*/ |
61
|
1 |
|
public function postAll(APIRequest $request): APIResponseData |
62
|
|
|
{ |
63
|
1 |
|
throw new UnsupportedMethodException('Method not supported'); |
64
|
|
|
} |
65
|
|
|
|
66
|
|
|
/** |
67
|
|
|
* @param APIRequest $request |
68
|
|
|
* @return APIResponseData |
69
|
|
|
* @throws UnsupportedMethodException |
70
|
|
|
* @throws ElementNotFoundException |
71
|
|
|
* @throws InvalidRequestException |
72
|
|
|
* @throws ElementConflictException |
73
|
|
|
*/ |
74
|
1 |
|
public function put(APIRequest $request): APIResponseData |
75
|
|
|
{ |
76
|
1 |
|
throw new UnsupportedMethodException('Method not supported'); |
77
|
|
|
} |
78
|
|
|
|
79
|
|
|
/** |
80
|
|
|
* @param APIRequest $request |
81
|
|
|
* @return APIResponseData |
82
|
|
|
* @throws UnsupportedMethodException |
83
|
|
|
* @throws InvalidRequestException |
84
|
|
|
* @throws ElementConflictException |
85
|
|
|
*/ |
86
|
1 |
|
public function putAll(APIRequest $request): APIResponseData |
87
|
|
|
{ |
88
|
1 |
|
throw new UnsupportedMethodException('Method not supported'); |
89
|
|
|
} |
90
|
|
|
|
91
|
|
|
/** |
92
|
|
|
* @param APIRequest $request |
93
|
|
|
* @return APIResponseData |
94
|
|
|
* @throws UnsupportedMethodException |
95
|
|
|
* @throws ElementNotFoundException |
96
|
|
|
* @throws InvalidRequestException |
97
|
|
|
* @throws ElementConflictException |
98
|
|
|
*/ |
99
|
1 |
|
public function patch(APIRequest $request): APIResponseData |
100
|
|
|
{ |
101
|
1 |
|
throw new UnsupportedMethodException('Method not supported'); |
102
|
|
|
} |
103
|
|
|
|
104
|
|
|
/** |
105
|
|
|
* @param APIRequest $request |
106
|
|
|
* @return APIResponseData |
107
|
|
|
* @throws UnsupportedMethodException |
108
|
|
|
* @throws InvalidRequestException |
109
|
|
|
* @throws ElementConflictException |
110
|
|
|
*/ |
111
|
1 |
|
public function patchAll(APIRequest $request): APIResponseData |
112
|
|
|
{ |
113
|
1 |
|
throw new UnsupportedMethodException('Method not supported'); |
114
|
|
|
} |
115
|
|
|
|
116
|
|
|
/** |
117
|
|
|
* @param APIRequest $request |
118
|
|
|
* @return APIResponseData |
119
|
|
|
* @throws UnsupportedMethodException |
120
|
|
|
* @throws ElementNotFoundException |
121
|
|
|
* @throws InvalidRequestException |
122
|
|
|
*/ |
123
|
1 |
|
public function options(APIRequest $request): APIResponseData |
124
|
|
|
{ |
125
|
1 |
|
throw new UnsupportedMethodException('Method not supported'); |
126
|
|
|
} |
127
|
|
|
|
128
|
|
|
/** |
129
|
|
|
* @param APIRequest $request |
130
|
|
|
* @return APIResponseData |
131
|
|
|
* @throws UnsupportedMethodException |
132
|
|
|
* @throws InvalidRequestException |
133
|
|
|
*/ |
134
|
1 |
|
public function optionsAll(APIRequest $request): APIResponseData |
135
|
|
|
{ |
136
|
1 |
|
throw new UnsupportedMethodException('Method not supported'); |
137
|
|
|
} |
138
|
|
|
|
139
|
|
|
/** |
140
|
|
|
* @param APIRequest $request |
141
|
|
|
* @return APIResponseData |
142
|
|
|
* @throws UnsupportedMethodException |
143
|
|
|
* @throws ElementNotFoundException |
144
|
|
|
* @throws InvalidRequestException |
145
|
|
|
*/ |
146
|
1 |
|
public function delete(APIRequest $request): APIResponseData |
147
|
|
|
{ |
148
|
1 |
|
throw new UnsupportedMethodException('Method not supported'); |
149
|
|
|
} |
150
|
|
|
|
151
|
|
|
/** |
152
|
|
|
* @param APIRequest $request |
153
|
|
|
* @return APIResponseData |
154
|
|
|
* @throws UnsupportedMethodException |
155
|
|
|
* @throws InvalidRequestException |
156
|
|
|
*/ |
157
|
1 |
|
public function deleteAll(APIRequest $request): APIResponseData |
158
|
|
|
{ |
159
|
1 |
|
throw new UnsupportedMethodException('Method not supported'); |
160
|
|
|
} |
161
|
|
|
} |
162
|
|
|
|