| @@ 11-28 (lines=18) @@ | ||
| 8 | ||
| 9 | class ErrorFactory |
|
| 10 | { |
|
| 11 | public static function buildUnsupportedMediaType( |
|
| 12 | $id = null, |
|
| 13 | LinkInterface $aboutLink = null, |
|
| 14 | $code = null, |
|
| 15 | array $source = null, |
|
| 16 | $meta = null |
|
| 17 | ): Error { |
|
| 18 | return new Error( |
|
| 19 | $id ?? null, |
|
| 20 | $aboutLink ?? new Link('http://jsonapi.org/format/#content-negotiation-clients'), |
|
| 21 | '415', |
|
| 22 | $code ?? null, |
|
| 23 | 'Unsupported Media Type', |
|
| 24 | 'Content-Type of a request containing JSON data must be application/vnd.api+json', |
|
| 25 | $source, |
|
| 26 | $meta |
|
| 27 | ); |
|
| 28 | } |
|
| 29 | ||
| 30 | public static function buildUnacceptable( |
|
| 31 | $id = null, |
|
| @@ 30-47 (lines=18) @@ | ||
| 27 | ); |
|
| 28 | } |
|
| 29 | ||
| 30 | public static function buildUnacceptable( |
|
| 31 | $id = null, |
|
| 32 | LinkInterface $aboutLink = null, |
|
| 33 | $code = null, |
|
| 34 | array $source = null, |
|
| 35 | $meta = null |
|
| 36 | ): Error { |
|
| 37 | return new Error( |
|
| 38 | $id ?? null, |
|
| 39 | $aboutLink ?? new Link('http://jsonapi.org/format/#content-negotiation-clients'), |
|
| 40 | '406', |
|
| 41 | $code ?? null, |
|
| 42 | 'Not Acceptable', |
|
| 43 | 'Accept header must accept application/vnd.api+json at least once without parameters', |
|
| 44 | $source, |
|
| 45 | $meta |
|
| 46 | ); |
|
| 47 | } |
|
| 48 | } |
|
| 49 | ||