MediaWiki  master
MediaWiki\Rest\Validator\Validator Class Reference

Wrapper for ParamValidator. More...

Collaboration diagram for MediaWiki\Rest\Validator\Validator:

Public Member Functions

 __construct (ObjectFactory $objectFactory, PermissionManager $permissionManager, RequestInterface $request, UserIdentity $user)
 
 validateBody (RequestInterface $request, Handler $handler)
 Validate the body of a request. More...
 
 validateParams (array $paramSettings)
 Validate parameters. More...
 

Private Attributes

ParamValidator $paramValidator
 

Detailed Description

Wrapper for ParamValidator.

It's intended to be used in the REST API classes by composition.

Since
1.34

Definition at line 29 of file Validator.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Rest\Validator\Validator::__construct ( ObjectFactory  $objectFactory,
PermissionManager  $permissionManager,
RequestInterface  $request,
UserIdentity  $user 
)
Parameters
ObjectFactory$objectFactory
PermissionManager$permissionManager
RequestInterface$request
UserIdentity$user

Definition at line 72 of file Validator.php.

Member Function Documentation

◆ validateBody()

MediaWiki\Rest\Validator\Validator::validateBody ( RequestInterface  $request,
Handler  $handler 
)

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
Handler$handlerUsed to call getBodyValidator()
Returns
mixed May be null
Exceptions
HttpExceptionon validation failure

Definition at line 125 of file Validator.php.

References MediaWiki\Rest\RequestInterface\getBody(), MediaWiki\Rest\Handler\getBodyValidator(), MediaWiki\Rest\RequestInterface\getHeaderLine(), and MediaWiki\Rest\RequestInterface\getMethod().

Referenced by MediaWiki\Rest\Handler\validate().

◆ validateParams()

MediaWiki\Rest\Validator\Validator::validateParams ( array  $paramSettings)

Member Data Documentation

◆ $paramValidator

ParamValidator MediaWiki\Rest\Validator\Validator::$paramValidator
private
Initial value:
=[,,]
private const FORM_DATA_CONTENT_TYPES
'application/x-www-form-urlencoded'
'multipart/form-data'

Definition at line 56 of file Validator.php.


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