Cache::validateTags

public static Cache::validateTags(array $tags)

Validates an array of cache tags.

Can be called before using cache tags in operations, to ensure validity.

Parameters

string[] $tags: An array of cache tags.

Throws

\LogicException

Deprecated

Use assert('\Drupal\Component\Assertion\Inspector::assertAllStrings($tags)');

File

core/lib/Drupal/Core/Cache/Cache.php, line 103

Class

Cache
Helper methods for cache.

Namespace

Drupal\Core\Cache

Code

public static function validateTags(array $tags) {
  if (empty($tags)) {
    return;
  }
  foreach ($tags as $value) {
    if (!is_string($value)) {
      throw new \LogicException('Cache tags must be strings, ' . gettype($value) . ' given.');
    }
  }
}
doc_Drupal
2016-10-29 08:49:10
Comments
Leave a Comment

Please login to continue.