function ResourceIdentifier::withArity

Same name in other branches
  1. 8.9.x core/modules/jsonapi/src/JsonApiResource/ResourceIdentifier.php \Drupal\jsonapi\JsonApiResource\ResourceIdentifier::withArity()
  2. 10 core/modules/jsonapi/src/JsonApiResource/ResourceIdentifier.php \Drupal\jsonapi\JsonApiResource\ResourceIdentifier::withArity()
  3. 11.x 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());
}

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