@@ 9-52 (lines=44) @@ | ||
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 $title |
|
19 | * @param string|null $detail |
|
20 | * @param string|null $instance |
|
21 | */ |
|
22 | public function __construct(array $invalidParameters, string $title, string $detail = null, string $instance = null) |
|
23 | { |
|
24 | parent::__construct($title, $detail, $instance); |
|
25 | ||
26 | $this->invalidParameters = $invalidParameters; |
|
27 | } |
|
28 | ||
29 | /** |
|
30 | * @return int |
|
31 | */ |
|
32 | public function getStatus(): int |
|
33 | { |
|
34 | return 400; |
|
35 | } |
|
36 | ||
37 | /** |
|
38 | * @return string |
|
39 | */ |
|
40 | public function getType(): string |
|
41 | { |
|
42 | return 'https://tools.ietf.org/html/rfc2616#section-10.4.1'; |
|
43 | } |
|
44 | ||
45 | /** |
|
46 | * @return array |
|
47 | */ |
|
48 | public function getInvalidParameters(): array |
|
49 | { |
|
50 | return $this->invalidParameters; |
|
51 | } |
|
52 | } |
|
53 |
@@ 9-52 (lines=44) @@ | ||
6 | ||
7 | use Chubbyphp\ApiHttp\ApiProblem\AbstractApiProblem; |
|
8 | ||
9 | final class ExpectationFailed extends AbstractApiProblem |
|
10 | { |
|
11 | /** |
|
12 | * @var string[] |
|
13 | */ |
|
14 | private $failedExpectations = []; |
|
15 | ||
16 | /** |
|
17 | * @param string[] $failedExpectations |
|
18 | * @param string $title |
|
19 | * @param string|null $detail |
|
20 | * @param string|null $instance |
|
21 | */ |
|
22 | public function __construct(array $failedExpectations, string $title, string $detail = null, string $instance = null) |
|
23 | { |
|
24 | parent::__construct($title, $detail, $instance); |
|
25 | ||
26 | $this->failedExpectations = $failedExpectations; |
|
27 | } |
|
28 | ||
29 | /** |
|
30 | * @return int |
|
31 | */ |
|
32 | public function getStatus(): int |
|
33 | { |
|
34 | return 417; |
|
35 | } |
|
36 | ||
37 | /** |
|
38 | * @return string |
|
39 | */ |
|
40 | public function getType(): string |
|
41 | { |
|
42 | return 'https://tools.ietf.org/html/rfc2616#section-10.4.18'; |
|
43 | } |
|
44 | ||
45 | /** |
|
46 | * @return string[] |
|
47 | */ |
|
48 | public function getFailedExpectations(): array |
|
49 | { |
|
50 | return $this->failedExpectations; |
|
51 | } |
|
52 | } |
|
53 |
@@ 9-52 (lines=44) @@ | ||
6 | ||
7 | use Chubbyphp\ApiHttp\ApiProblem\AbstractApiProblem; |
|
8 | ||
9 | final class PaymentRequired extends AbstractApiProblem |
|
10 | { |
|
11 | /** |
|
12 | * @var string[] |
|
13 | */ |
|
14 | private $paymentTypes = []; |
|
15 | ||
16 | /** |
|
17 | * @param string[] $paymentTypes |
|
18 | * @param string $title |
|
19 | * @param string|null $detail |
|
20 | * @param string|null $instance |
|
21 | */ |
|
22 | public function __construct(array $paymentTypes, string $title, string $detail = null, string $instance = null) |
|
23 | { |
|
24 | parent::__construct($title, $detail, $instance); |
|
25 | ||
26 | $this->paymentTypes = $paymentTypes; |
|
27 | } |
|
28 | ||
29 | /** |
|
30 | * @return int |
|
31 | */ |
|
32 | public function getStatus(): int |
|
33 | { |
|
34 | return 402; |
|
35 | } |
|
36 | ||
37 | /** |
|
38 | * @return string |
|
39 | */ |
|
40 | public function getType(): string |
|
41 | { |
|
42 | return 'https://tools.ietf.org/html/rfc2616#section-10.4.3'; |
|
43 | } |
|
44 | ||
45 | /** |
|
46 | * @return string[] |
|
47 | */ |
|
48 | public function getPaymentTypes(): array |
|
49 | { |
|
50 | return $this->paymentTypes; |
|
51 | } |
|
52 | } |
|
53 |
@@ 9-52 (lines=44) @@ | ||
6 | ||
7 | use Chubbyphp\ApiHttp\ApiProblem\AbstractApiProblem; |
|
8 | ||
9 | final class PreconditionFailed extends AbstractApiProblem |
|
10 | { |
|
11 | /** |
|
12 | * @var string[] |
|
13 | */ |
|
14 | private $failedPreconditions = []; |
|
15 | ||
16 | /** |
|
17 | * @param string[] $failedPreconditions |
|
18 | * @param string $title |
|
19 | * @param string|null $detail |
|
20 | * @param string|null $instance |
|
21 | */ |
|
22 | public function __construct(array $failedPreconditions, string $title, string $detail = null, string $instance = null) |
|
23 | { |
|
24 | parent::__construct($title, $detail, $instance); |
|
25 | ||
26 | $this->failedPreconditions = $failedPreconditions; |
|
27 | } |
|
28 | ||
29 | /** |
|
30 | * @return int |
|
31 | */ |
|
32 | public function getStatus(): int |
|
33 | { |
|
34 | return 412; |
|
35 | } |
|
36 | ||
37 | /** |
|
38 | * @return string |
|
39 | */ |
|
40 | public function getType(): string |
|
41 | { |
|
42 | return 'https://tools.ietf.org/html/rfc2616#section-10.4.13'; |
|
43 | } |
|
44 | ||
45 | /** |
|
46 | * @return string[] |
|
47 | */ |
|
48 | public function getFailedPreconditions(): array |
|
49 | { |
|
50 | return $this->failedPreconditions; |
|
51 | } |
|
52 | } |
|
53 |
@@ 9-52 (lines=44) @@ | ||
6 | ||
7 | use Chubbyphp\ApiHttp\ApiProblem\AbstractApiProblem; |
|
8 | ||
9 | final class RequestEntityTooLarge extends AbstractApiProblem |
|
10 | { |
|
11 | /** |
|
12 | * @var int |
|
13 | */ |
|
14 | private $maxContentLength; |
|
15 | ||
16 | /** |
|
17 | * @param int $maxContentLength |
|
18 | * @param string $title |
|
19 | * @param string|null $detail |
|
20 | * @param string|null $instance |
|
21 | */ |
|
22 | public function __construct(int $maxContentLength, string $title, string $detail = null, string $instance = null) |
|
23 | { |
|
24 | parent::__construct($title, $detail, $instance); |
|
25 | ||
26 | $this->maxContentLength = $maxContentLength; |
|
27 | } |
|
28 | ||
29 | /** |
|
30 | * @return int |
|
31 | */ |
|
32 | public function getStatus(): int |
|
33 | { |
|
34 | return 413; |
|
35 | } |
|
36 | ||
37 | /** |
|
38 | * @return int |
|
39 | */ |
|
40 | public function getType(): string |
|
41 | { |
|
42 | return 'https://tools.ietf.org/html/rfc2616#section-10.4.14'; |
|
43 | } |
|
44 | ||
45 | /** |
|
46 | * @return int |
|
47 | */ |
|
48 | public function getMaxContentLength(): int |
|
49 | { |
|
50 | return $this->maxContentLength; |
|
51 | } |
|
52 | } |
|
53 |
@@ 9-52 (lines=44) @@ | ||
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 $title |
|
19 | * @param string|null $detail |
|
20 | * @param string|null $instance |
|
21 | */ |
|
22 | public function __construct(array $invalidParameters, string $title, string $detail = null, string $instance = null) |
|
23 | { |
|
24 | parent::__construct($title, $detail, $instance); |
|
25 | ||
26 | $this->invalidParameters = $invalidParameters; |
|
27 | } |
|
28 | ||
29 | /** |
|
30 | * @return int |
|
31 | */ |
|
32 | public function getStatus(): int |
|
33 | { |
|
34 | return 422; |
|
35 | } |
|
36 | ||
37 | /** |
|
38 | * @return string |
|
39 | */ |
|
40 | public function getType(): string |
|
41 | { |
|
42 | return 'https://tools.ietf.org/html/rfc4918#section-11.2'; |
|
43 | } |
|
44 | ||
45 | /** |
|
46 | * @return array |
|
47 | */ |
|
48 | public function getInvalidParameters(): array |
|
49 | { |
|
50 | return $this->invalidParameters; |
|
51 | } |
|
52 | } |
|
53 |
@@ 9-52 (lines=44) @@ | ||
6 | ||
7 | use Chubbyphp\ApiHttp\ApiProblem\AbstractApiProblem; |
|
8 | ||
9 | final class UnsupportedMediaType extends AbstractApiProblem |
|
10 | { |
|
11 | /** |
|
12 | * @var string[] |
|
13 | */ |
|
14 | private $supportedMediaTypes = []; |
|
15 | ||
16 | /** |
|
17 | * @param string[] $supportedMediaTypes |
|
18 | * @param string $title |
|
19 | * @param string|null $detail |
|
20 | * @param string|null $instance |
|
21 | */ |
|
22 | public function __construct(array $supportedMediaTypes, string $title, string $detail = null, string $instance = null) |
|
23 | { |
|
24 | parent::__construct($title, $detail, $instance); |
|
25 | ||
26 | $this->supportedMediaTypes = $supportedMediaTypes; |
|
27 | } |
|
28 | ||
29 | /** |
|
30 | * @return int |
|
31 | */ |
|
32 | public function getStatus(): int |
|
33 | { |
|
34 | return 415; |
|
35 | } |
|
36 | ||
37 | /** |
|
38 | * @return string |
|
39 | */ |
|
40 | public function getType(): string |
|
41 | { |
|
42 | return 'https://tools.ietf.org/html/rfc2616#section-10.4.16'; |
|
43 | } |
|
44 | ||
45 | /** |
|
46 | * @return string[] |
|
47 | */ |
|
48 | public function getSupportedMediaTypes(): array |
|
49 | { |
|
50 | return $this->supportedMediaTypes; |
|
51 | } |
|
52 | } |
|
53 |