diff --git a/jsonapi.api.php b/jsonapi.api.php index 1a09422..8c63bfc 100644 --- a/jsonapi.api.php +++ b/jsonapi.api.php @@ -97,7 +97,7 @@ * / \ * ?resource_version=foo:bar * \_/ \_/ - * | | + * | | * version-negotiator | * version-argument * @endcode @@ -108,7 +108,7 @@ * @endcode or @code rel @endcode. The @code id @endcode negotiator takes a * version argument which is the desired revision ID. The @code rel @endcode * negotiator takes a version argument which is either the string @code - * latest-version @encode or the string @code latest-version @encode. + * latest-version @endcode or the string @code working-copy @endcode. * * In future, other negotiators may be developed. For instance, a negotiator * which is timestamp or workspace based. diff --git a/src/Revisions/Annotation/VersionNegotiation.php b/src/Revisions/Annotation/VersionNegotiation.php index 9cade53..9aa85c9 100644 --- a/src/Revisions/Annotation/VersionNegotiation.php +++ b/src/Revisions/Annotation/VersionNegotiation.php @@ -5,7 +5,7 @@ namespace Drupal\jsonapi\Revisions\Annotation; use Drupal\Component\Annotation\Plugin; /** - * Defines an version negotiation plugin annotation object. + * Defines a version negotiation plugin annotation object. * * Plugin Namespace: Plugin\VersionNegotiation. * diff --git a/src/Revisions/ResourceVersionRouteEnhancer.php b/src/Revisions/ResourceVersionRouteEnhancer.php index ca601a0..f03f6a3 100644 --- a/src/Revisions/ResourceVersionRouteEnhancer.php +++ b/src/Revisions/ResourceVersionRouteEnhancer.php @@ -44,7 +44,7 @@ class ResourceVersionRouteEnhancer implements EnhancerInterface { * * @var string */ - const RESOURCE_VERSION_PARAM_VALIDATOR = '/^[a-z]+[a-z_]*[a-z]+' + const VERSION_IDENTIFIER_VALIDATOR = '/^[a-z]+[a-z_]*[a-z]+' . VersionNegotiationManager::SEPARATOR . '[a-zA-Z0-9\-]+(' . VersionNegotiationManager::SEPARATOR @@ -89,7 +89,7 @@ class ResourceVersionRouteEnhancer implements EnhancerInterface { $resource_version_identifier = $request->query->get(static::RESOURCE_VERSION_QUERY_PARAMETER); - if (!static::isValidResourceVersionIdentifier($resource_version_identifier)) { + if (!static::isValidVersionIdentifier($resource_version_identifier)) { $cacheability = (new CacheableMetadata())->addCacheContexts(['url.query_args:' . ResourceVersionRouteEnhancer::RESOURCE_VERSION_QUERY_PARAMETER]); $message = sprintf('A resource version identifier was provided in an invalid format: `%s`', $resource_version_identifier); throw new CacheableBadRequestHttpException($cacheability, $message); @@ -132,8 +132,8 @@ class ResourceVersionRouteEnhancer implements EnhancerInterface { * @return bool * TRUE if the received resource version value is valid, FALSE otherwise. */ - protected static function isValidResourceVersionIdentifier($resource_version) { - return preg_match(static::RESOURCE_VERSION_PARAM_VALIDATOR, $resource_version) === 1; + protected static function isValidVersionIdentifier($resource_version) { + return preg_match(static::VERSION_IDENTIFIER_VALIDATOR, $resource_version) === 1; } } diff --git a/src/Revisions/VersionNegotiationManager.php b/src/Revisions/VersionNegotiationManager.php index 0e67a57..6cf9dde 100644 --- a/src/Revisions/VersionNegotiationManager.php +++ b/src/Revisions/VersionNegotiationManager.php @@ -13,7 +13,7 @@ use Drupal\Core\Plugin\DefaultPluginManager; use Drupal\jsonapi\Revisions\Annotation\VersionNegotiation; /** - * Provides an version negotiation plugin manager. + * Provides a version negotiation plugin manager. * * @see \Drupal\jsonapi\Revisions\Annotation\VersionNegotiation * @see \Drupal\jsonapi\Revisions\VersionNegotiationInterface