MediaWiki
master
UnsupportedContentTypeBodyValidator.php
Go to the documentation of this file.
1
<?php
2
3
namespace
MediaWiki\Rest\Validator
;
4
5
use
MediaWiki\Rest\LocalizedHttpException
;
6
use
MediaWiki\Rest\RequestInterface
;
7
use
Wikimedia\Message\MessageValue
;
8
21
class
UnsupportedContentTypeBodyValidator
implements
BodyValidator
{
22
24
private
string
$contentType;
25
29
public
function
__construct
(
string
$contentType ) {
30
$this->contentType = $contentType;
31
}
32
37
public
function
validateBody
(
RequestInterface
$request ) {
38
throw
new
LocalizedHttpException
(
39
new
MessageValue
(
'rest-unsupported-content-type'
, [ $this->contentType ] ),
40
415
41
);
42
}
43
44
}
MediaWiki\Rest\LocalizedHttpException
Definition
LocalizedHttpException.php:11
MediaWiki\Rest\Validator\UnsupportedContentTypeBodyValidator
Validator that always fails.
Definition
UnsupportedContentTypeBodyValidator.php:21
MediaWiki\Rest\Validator\UnsupportedContentTypeBodyValidator\validateBody
validateBody(RequestInterface $request)
Validate the body of a request.This may return a data structure representing the parsed body....
Definition
UnsupportedContentTypeBodyValidator.php:37
MediaWiki\Rest\Validator\UnsupportedContentTypeBodyValidator\__construct
__construct(string $contentType)
Definition
UnsupportedContentTypeBodyValidator.php:29
Wikimedia\Message\MessageValue
Value object representing a message for i18n.
Definition
MessageValue.php:19
MediaWiki\Rest\RequestInterface
A request interface similar to PSR-7's ServerRequestInterface.
Definition
RequestInterface.php:39
MediaWiki\Rest\Validator\BodyValidator
Interface for validating a request body.
Definition
BodyValidator.php:16
MediaWiki\Rest\Validator
Definition
BodyValidator.php:3
includes
Rest
Validator
UnsupportedContentTypeBodyValidator.php
Generated on Fri Nov 8 2024 21:25:21 for MediaWiki by
1.10.0