You are here

protected static function LinkCollection::validKey in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/jsonapi/src/JsonApiResource/LinkCollection.php \Drupal\jsonapi\JsonApiResource\LinkCollection::validKey()

Ensures that a link key is valid.

Parameters

string $key: A key name.

Return value

bool TRUE if the key is valid, FALSE otherwise.

2 calls to LinkCollection::validKey()
LinkCollection::withLink in core/modules/jsonapi/src/JsonApiResource/LinkCollection.php
Gets a new LinkCollection with the given link inserted.
LinkCollection::__construct in core/modules/jsonapi/src/JsonApiResource/LinkCollection.php
LinkCollection constructor.

File

core/modules/jsonapi/src/JsonApiResource/LinkCollection.php, line 196

Class

LinkCollection
Contains a set of JSON:API Link objects.

Namespace

Drupal\jsonapi\JsonApiResource

Code

protected static function validKey($key) {
  return is_string($key) && !is_numeric($key) && strpos($key, ':') === FALSE;
}