|
MediaWiki master
|
Validator that always fails. More...
Inherits MediaWiki\Rest\Validator\BodyValidator.

Public Member Functions | ||||||
| __construct (private readonly string $contentType,) | ||||||
| validateBody (RequestInterface $request) | ||||||
Validate the body of a request.This may return a data structure representing the parsed body. When used in the context of Handler\validateParams(), the returned value will be available to the handler via Handler\getValidatedBody().
| ||||||
Validator that always fails.
Meant as a convenience for Handler::getBodyValidator():
public function getBodyValidator( $contentType ) {
if ( $contentType === 'supported/content-type' ) {
return new MyValidator();
}
return new UnsupportedContentTypeBodyValidator( $contentType );
}
Definition at line 21 of file UnsupportedContentTypeBodyValidator.php.
| MediaWiki\Rest\Validator\UnsupportedContentTypeBodyValidator::__construct | ( | private readonly string | $contentType | ) |
Definition at line 23 of file UnsupportedContentTypeBodyValidator.php.
| MediaWiki\Rest\Validator\UnsupportedContentTypeBodyValidator::validateBody | ( | RequestInterface | $request | ) |
Validate the body of a request.This may return a data structure representing the parsed body. When used in the context of Handler\validateParams(), the returned value will be available to the handler via Handler\getValidatedBody().
| RequestInterface | $request |
| HttpException | on validation failure |
Implements MediaWiki\Rest\Validator\BodyValidator.
Definition at line 32 of file UnsupportedContentTypeBodyValidator.php.
References $request.