public static function compare(ResourceIdentifier
$a, ResourceIdentifier
$b) { $result =
strcmp(sprintf('%s:%s',
$a->
getTypeName(),
$a->
getId()),
sprintf('%s:%s',
$b->
getTypeName(),
$b->
getId()));
// If type and ID do not match, return their ordering.
if ($result !== 0
) { return $result;
} // If both $a and $b have an arity, then return the order by arity.
// Otherwise, they are considered equal.
return $a->
hasArity() &&
$b->
hasArity() ?
$a->
getArity() -
$b->
getArity() : 0;
} /**
* Deduplicates an array of ResourceIdentifier objects.
*
* @param \Drupal\jsonapi\JsonApiResource\ResourceIdentifier[] $resource_identifiers
* The list of ResourceIdentifiers to deduplicate.
*
* @return \Drupal\jsonapi\JsonApiResource\ResourceIdentifier[]
* A deduplicated array of ResourceIdentifier objects.
*
* @see self::isDuplicate()
*/