function ResourceIdentifier::areResourceIdentifiersUnique

Same name in other branches
  1. 9 core/modules/jsonapi/src/JsonApiResource/ResourceIdentifier.php \Drupal\jsonapi\JsonApiResource\ResourceIdentifier::areResourceIdentifiersUnique()
  2. 8.9.x core/modules/jsonapi/src/JsonApiResource/ResourceIdentifier.php \Drupal\jsonapi\JsonApiResource\ResourceIdentifier::areResourceIdentifiersUnique()
  3. 10 core/modules/jsonapi/src/JsonApiResource/ResourceIdentifier.php \Drupal\jsonapi\JsonApiResource\ResourceIdentifier::areResourceIdentifiersUnique()

Determines if an array of ResourceIdentifier objects is duplicate free.

Parameters

\Drupal\jsonapi\JsonApiResource\ResourceIdentifier[] $resource_identifiers: The list of ResourceIdentifiers to assess.

Return value

bool Whether all the given resource identifiers are unique.

1 call to ResourceIdentifier::areResourceIdentifiersUnique()
ResourceIdentifierNormalizer::denormalize in core/modules/jsonapi/src/Normalizer/ResourceIdentifierNormalizer.php

File

core/modules/jsonapi/src/JsonApiResource/ResourceIdentifier.php, line 267

Class

ResourceIdentifier
Represents a JSON:API resource identifier object.

Namespace

Drupal\jsonapi\JsonApiResource

Code

public static function areResourceIdentifiersUnique(array $resource_identifiers) {
    return count($resource_identifiers) === count(static::deduplicate($resource_identifiers));
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.