public static function Cache::mergeContexts

public static Cache::mergeContexts(array $a = [], array $b = [])

Merges arrays of cache contexts and removes duplicates.

Parameters

array $a: Cache contexts array to merge.

array $b: Cache contexts array to merge.

Return value

string[] The merged array of cache contexts.

File

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

Class

Cache
Helper methods for cache.

Namespace

Drupal\Core\Cache

Code

public static function mergeContexts(array $a = [], array $b = []) {
  $cache_contexts = array_unique(array_merge($a, $b));
  assert('\Drupal::service(\'cache_contexts_manager\')->assertValidTokens($cache_contexts)');
  sort($cache_contexts);
  return $cache_contexts;
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Cache!Cache.php/function/Cache::mergeContexts/8.1.x