Class Preconditions
A REST API request options helper providing precondition features. This is similar to the CacheDirectives class, but applies inverse logic.
Class Preconditions
- Gedcomx\Rs\Client\Options\Preconditions implements Gedcomx\Rs\Client\Options\StateTransitionOption
Package: Gedcomx\Rs\Client\Options
Located at Rs/Client/Options/Preconditions.php
Methods summary
public
|
#
setLastModified( DateTime $lastModified )
Sets the last modified date to send to the server for evaluation. If the last modified date specified here matches the server's last modified date for a resource, the resource will be returned; otherwise, a precondition-failed status is returned. |
public
|
|
public
|
#
setBothConditions( string $etag, DateTime $lastModified )
Sets the last modified date and ETag to send to the server for evaluation. If the ETag (entity tag) specified here matches the server's ETag for a resource, the resource will be returned; otherwise, a precondition-failed status is returned. The same applies to last modified. If the server's last modified date for a resource is equal to the last modified specified here, the resource will be returned; otherwise, a precondition-failed status is returned. |
public
|
#
setState(
Sets the state to use for specifying the last modified date and ETag. The last modified date and ETag values used in the preconditions will come from the specified state instance. |
public
GuzzleHttp\Psr7\Request
|
#
apply( GuzzleHttp\Psr7\Request $request, GuzzleHttp\Psr7\Request $request,… )
Applies the ETag or last modified cache control headers to the specified REST API request. The cache control headers are applied conditionally. The ETag and last modified values will only be applied if they are not null. Furthermore, the application of each are independent of the other. This could, therefore, only apply a last modified cache control header and not an ETag cache control header if the ETag property of this instance were null and last modified was not. |