1 | <?php |
||
23 | class PresentationFactory |
||
24 | { |
||
25 | /** |
||
26 | * Create the presentation |
||
27 | * |
||
28 | * @param int $statusCode |
||
29 | * @param ResourceInterface $resource |
||
30 | * |
||
31 | * @return PresentationInterface |
||
32 | */ |
||
33 | 38 | public static function create(int $statusCode, ResourceInterface $resource = null): PresentationInterface |
|
37 | |||
38 | /** |
||
39 | * Create the success presentation |
||
40 | * |
||
41 | * @param ResourceInterface $resource |
||
42 | * |
||
43 | * @return PresentationInterface |
||
44 | */ |
||
45 | 1 | public static function ok(ResourceInterface $resource): PresentationInterface |
|
49 | |||
50 | /** |
||
51 | * Create the created presentation |
||
52 | * |
||
53 | * @param ResourceInterface|null $resource |
||
54 | * |
||
55 | * @return PresentationInterface |
||
56 | */ |
||
57 | 2 | public static function created(ResourceInterface $resource = null): PresentationInterface |
|
61 | |||
62 | /** |
||
63 | * Create accepted presentation |
||
64 | * |
||
65 | * @param ResourceInterface $resource |
||
66 | * |
||
67 | * @return PresentationInterface |
||
68 | */ |
||
69 | 2 | public static function accepted(ResourceInterface $resource = null): PresentationInterface |
|
73 | |||
74 | /** |
||
75 | * Create non-authoritative information presentation |
||
76 | * |
||
77 | * @param ResourceInterface $resource |
||
78 | * |
||
79 | * @return PresentationInterface |
||
80 | */ |
||
81 | 1 | public static function nonAuthoritativeInformation(ResourceInterface $resource): PresentationInterface |
|
85 | |||
86 | /** |
||
87 | * Create the no content presentation |
||
88 | * |
||
89 | * @return PresentationInterface |
||
90 | */ |
||
91 | 1 | public static function noContent(): PresentationInterface |
|
95 | |||
96 | /** |
||
97 | * Create the reset content presentation |
||
98 | * |
||
99 | * @return PresentationInterface |
||
100 | */ |
||
101 | 1 | public static function resetContent(): PresentationInterface |
|
105 | |||
106 | /** |
||
107 | * Create the bad request presentation |
||
108 | * |
||
109 | * @param ResourceInterface $resource |
||
110 | * |
||
111 | * @return PresentationInterface |
||
112 | */ |
||
113 | 3 | public static function badRequest(ResourceInterface $resource = null): PresentationInterface |
|
117 | |||
118 | /** |
||
119 | * Create unauthorized presentation |
||
120 | * |
||
121 | * @param ResourceInterface $resource |
||
122 | * |
||
123 | * @return PresentationInterface |
||
124 | */ |
||
125 | 3 | public static function unauthorized(ResourceInterface $resource = null): PresentationInterface |
|
129 | |||
130 | /** |
||
131 | * Create forbidden presentation |
||
132 | * |
||
133 | * @param ResourceInterface $resource |
||
134 | * |
||
135 | * @return PresentationInterface |
||
136 | */ |
||
137 | 3 | public static function forbidden(ResourceInterface $resource = null): PresentationInterface |
|
141 | |||
142 | /** |
||
143 | * Create not found presentation |
||
144 | * |
||
145 | * @param ResourceInterface|null $resource |
||
146 | * |
||
147 | * @return PresentationInterface |
||
148 | */ |
||
149 | 3 | public static function notFound(ResourceInterface $resource = null): PresentationInterface |
|
153 | |||
154 | /** |
||
155 | * Create conflict presentation |
||
156 | * |
||
157 | * @param ResourceInterface $resource |
||
158 | * |
||
159 | * @return PresentationInterface |
||
160 | */ |
||
161 | 3 | public static function conflict(ResourceInterface $resource = null): PresentationInterface |
|
165 | |||
166 | /** |
||
167 | * Create gone presentation |
||
168 | * |
||
169 | * @param ResourceInterface $resource |
||
170 | * |
||
171 | * @return PresentationInterface |
||
172 | */ |
||
173 | 3 | public static function gone(ResourceInterface $resource = null): PresentationInterface |
|
177 | |||
178 | /** |
||
179 | * Create request entity to large presentation |
||
180 | * |
||
181 | * @param ResourceInterface $resource |
||
182 | * |
||
183 | * @return PresentationInterface |
||
184 | */ |
||
185 | 3 | public static function requestEntityToLarge(ResourceInterface $resource = null): PresentationInterface |
|
189 | |||
190 | /** |
||
191 | * Create unsupported media type presentation |
||
192 | * |
||
193 | * @param ResourceInterface $resource |
||
194 | * |
||
195 | * @return PresentationInterface |
||
196 | */ |
||
197 | 3 | public static function unsupportedMediaType(ResourceInterface $resource = null): PresentationInterface |
|
201 | |||
202 | /** |
||
203 | * Create internal server error presentation |
||
204 | * |
||
205 | * @param ResourceInterface $resource |
||
206 | * |
||
207 | * @return PresentationInterface |
||
208 | */ |
||
209 | 3 | public static function internalServerError(ResourceInterface $resource = null): PresentationInterface |
|
213 | } |
||
214 |