| @@ 9-41 (lines=33) @@ | ||
| 6 | ||
| 7 | use Chubbyphp\ApiHttp\ApiProblem\AbstractApiProblem; |
|
| 8 | ||
| 9 | final class BadRequest extends AbstractApiProblem |
|
| 10 | { |
|
| 11 | /** |
|
| 12 | * @var array[] |
|
| 13 | */ |
|
| 14 | private $invalidParameters = []; |
|
| 15 | ||
| 16 | /** |
|
| 17 | * @param array $invalidParameters |
|
| 18 | * @param string|null $detail |
|
| 19 | * @param string|null $instance |
|
| 20 | */ |
|
| 21 | public function __construct(array $invalidParameters, string $detail = null, string $instance = null) |
|
| 22 | { |
|
| 23 | parent::__construct( |
|
| 24 | 'https://tools.ietf.org/html/rfc2616#section-10.4.1', |
|
| 25 | 400, |
|
| 26 | 'Bad Request', |
|
| 27 | $detail, |
|
| 28 | $instance |
|
| 29 | ); |
|
| 30 | ||
| 31 | $this->invalidParameters = $invalidParameters; |
|
| 32 | } |
|
| 33 | ||
| 34 | /** |
|
| 35 | * @return array |
|
| 36 | */ |
|
| 37 | public function getInvalidParameters(): array |
|
| 38 | { |
|
| 39 | return $this->invalidParameters; |
|
| 40 | } |
|
| 41 | } |
|
| 42 | ||
| @@ 9-41 (lines=33) @@ | ||
| 6 | ||
| 7 | use Chubbyphp\ApiHttp\ApiProblem\AbstractApiProblem; |
|
| 8 | ||
| 9 | final class UnprocessableEntity extends AbstractApiProblem |
|
| 10 | { |
|
| 11 | /** |
|
| 12 | * @var array[] |
|
| 13 | */ |
|
| 14 | private $invalidParameters = []; |
|
| 15 | ||
| 16 | /** |
|
| 17 | * @param array $invalidParameters |
|
| 18 | * @param string|null $detail |
|
| 19 | * @param string|null $instance |
|
| 20 | */ |
|
| 21 | public function __construct(array $invalidParameters, string $detail = null, string $instance = null) |
|
| 22 | { |
|
| 23 | parent::__construct( |
|
| 24 | 'https://tools.ietf.org/html/rfc4918#section-11.2', |
|
| 25 | 422, |
|
| 26 | 'Unprocessable Entity', |
|
| 27 | $detail, |
|
| 28 | $instance |
|
| 29 | ); |
|
| 30 | ||
| 31 | $this->invalidParameters = $invalidParameters; |
|
| 32 | } |
|
| 33 | ||
| 34 | /** |
|
| 35 | * @return array |
|
| 36 | */ |
|
| 37 | public function getInvalidParameters(): array |
|
| 38 | { |
|
| 39 | return $this->invalidParameters; |
|
| 40 | } |
|
| 41 | } |
|
| 42 | ||