comparison core/modules/jsonapi/src/Revisions/VersionById.php @ 5:12f9dff5fda9 tip

Update to Drupal core 8.7.1
author Chris Cannam
date Thu, 09 May 2019 15:34:47 +0100
parents
children
comparison
equal deleted inserted replaced
4:a9cd425dd02b 5:12f9dff5fda9
1 <?php
2
3 namespace Drupal\jsonapi\Revisions;
4
5 use Drupal\Core\Entity\EntityInterface;
6
7 /**
8 * Defines a revision ID implementation for entity revision ID values.
9 *
10 * @internal JSON:API maintains no PHP API since its API is the HTTP API. This
11 * class may change at any time and this will break any dependencies on it.
12 *
13 * @see https://www.drupal.org/project/jsonapi/issues/3032787
14 * @see jsonapi.api.php
15 */
16 class VersionById extends NegotiatorBase implements VersionNegotiatorInterface {
17
18 /**
19 * {@inheritdoc}
20 */
21 protected function getRevisionId(EntityInterface $entity, $version_argument) {
22 if (!is_numeric($version_argument)) {
23 throw new InvalidVersionIdentifierException('The revision ID must be an integer.');
24 }
25 return $version_argument;
26 }
27
28 }