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