| 1 | <?php |
| 2 | |
| 3 | namespace MediaWiki\Rest\Validator; |
| 4 | |
| 5 | use MediaWiki\Rest\HttpException; |
| 6 | use MediaWiki\Rest\RequestInterface; |
| 7 | |
| 8 | /** |
| 9 | * Interface for validating a request body |
| 10 | * |
| 11 | * @deprecated since 1.43, because Handler::getBodyValidator() is deprecated. |
| 12 | * No longer stable to implement. |
| 13 | * |
| 14 | * @see \MediaWiki\Rest\Handler::getBodyValidator() |
| 15 | */ |
| 16 | interface BodyValidator { |
| 17 | |
| 18 | /** |
| 19 | * Validate the body of a request. |
| 20 | * |
| 21 | * This may return a data structure representing the parsed body. When used |
| 22 | * in the context of Handler::validateParams(), the returned value will be |
| 23 | * available to the handler via Handler::getValidatedBody(). |
| 24 | * |
| 25 | * @param RequestInterface $request |
| 26 | * @return mixed|null |
| 27 | * @throws HttpException on validation failure |
| 28 | */ |
| 29 | public function validateBody( RequestInterface $request ); |
| 30 | |
| 31 | } |