MediaWiki master
MediaWiki\Rest\Validator\UnsupportedContentTypeBodyValidator Class Reference

Validator that always fails. More...

Inherits MediaWiki\Rest\Validator\BodyValidator.

Collaboration diagram for MediaWiki\Rest\Validator\UnsupportedContentTypeBodyValidator:

Public Member Functions

 __construct (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().
Parameters
RequestInterface$request
Returns
mixed|null
Exceptions
HttpExceptionon validation failure

 

Detailed Description

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 );
}
Since
1.40

Definition at line 21 of file UnsupportedContentTypeBodyValidator.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Rest\Validator\UnsupportedContentTypeBodyValidator::__construct ( string $contentType)
Parameters
string$contentType

Definition at line 29 of file UnsupportedContentTypeBodyValidator.php.

Member Function Documentation

◆ validateBody()

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().

Parameters
RequestInterface$request
Returns
mixed|null
Exceptions
HttpExceptionon validation failure

Returns
never

Implements MediaWiki\Rest\Validator\BodyValidator.

Definition at line 37 of file UnsupportedContentTypeBodyValidator.php.


The documentation for this class was generated from the following file: