You are here

public function ResourceIdentifier::withArity in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/jsonapi/src/JsonApiResource/ResourceIdentifier.php \Drupal\jsonapi\JsonApiResource\ResourceIdentifier::withArity()

Returns a copy of the given ResourceIdentifier with the given arity.

Parameters

int $arity: The new arity; must be a non-negative integer.

Return value

static A newly created ResourceIdentifier with the given arity, otherwise the same.

File

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

Class

ResourceIdentifier
Represents a JSON:API resource identifier object.

Namespace

Drupal\jsonapi\JsonApiResource

Code

public function withArity($arity) {
  return new static($this
    ->getResourceType(), $this
    ->getId(), [
    static::ARITY_KEY => $arity,
  ] + $this
    ->getMeta());
}