Wrapper around an ItemRevisionMetadataRetriever and ConditionalHeaderUtil to check whether a request meets the preconditions for a certain response code.
More...
Wrapper around an ItemRevisionMetadataRetriever and ConditionalHeaderUtil to check whether a request meets the preconditions for a certain response code.
- Copyright
- GPL-2.0-or-later
◆ __construct()
Wikibase\Repo\RestApi\RouteHandlers\Middleware\RequestPreconditionCheck::__construct |
( |
EntityRevisionLookup | $revisionLookup, |
|
|
EntityIdParser | $entityIdParser, |
|
|
callable | $getEntityIdFromRequest, |
|
|
ConditionalHeaderUtil | $conditionalHeaderUtil ) |
◆ checkPreconditions()
Wikibase\Repo\RestApi\RouteHandlers\Middleware\RequestPreconditionCheck::checkPreconditions |
( |
RequestInterface | $request | ) |
|
Calling an EntityRevisionLookup directly from the middleware violates the "flow of control" rule as it bypasses the input port and domain layer (see the 4th bullet point in ADR 1). We have made the conscious decision to allow an exception for the following reasons:
- The middleware is quite isolated and can easily be reimplement
- Doing this "properly" would result in more complex code and tests without much added value except for "following the rules"
◆ getCheckResultFromRequestAndMetadata()
Wikibase\Repo\RestApi\RouteHandlers\Middleware\RequestPreconditionCheck::getCheckResultFromRequestAndMetadata |
( |
RequestInterface | $request, |
|
|
int | $revisionId, |
|
|
string | $revisionTimestamp ) |
|
private |
◆ getSubjectIdPrefixFromStatementId()
static Wikibase\Repo\RestApi\RouteHandlers\Middleware\RequestPreconditionCheck::getSubjectIdPrefixFromStatementId |
( |
string | $statementId | ) |
|
|
static |
Convenience function to use with the $getEntityIdFromRequest callable and dealing with statement IDs.
◆ $conditionalHeaderUtil
ConditionalHeaderUtil Wikibase\Repo\RestApi\RouteHandlers\Middleware\RequestPreconditionCheck::$conditionalHeaderUtil |
|
private |
◆ $entityIdParser
EntityIdParser Wikibase\Repo\RestApi\RouteHandlers\Middleware\RequestPreconditionCheck::$entityIdParser |
|
private |
◆ $getEntityIdFromRequest
Wikibase\Repo\RestApi\RouteHandlers\Middleware\RequestPreconditionCheck::$getEntityIdFromRequest |
|
private |
◆ $revisionLookup
EntityRevisionLookup Wikibase\Repo\RestApi\RouteHandlers\Middleware\RequestPreconditionCheck::$revisionLookup |
|
private |
The documentation for this class was generated from the following file: