comparison core/lib/Drupal/Core/Cache/Cache.php @ 14:1fec387a4317

Update Drupal core to 8.5.2 via Composer
author Chris Cannam
date Mon, 23 Apr 2018 09:46:53 +0100
parents 4c8ae668cc8c
children
comparison
equal deleted inserted replaced
13:5fb285c0d0e3 14:1fec387a4317
1 <?php 1 <?php
2 2
3 namespace Drupal\Core\Cache; 3 namespace Drupal\Core\Cache;
4 4
5 use Drupal\Component\Assertion\Inspector;
5 use Drupal\Core\Database\Query\SelectInterface; 6 use Drupal\Core\Database\Query\SelectInterface;
6 7
7 /** 8 /**
8 * Helper methods for cache. 9 * Helper methods for cache.
9 * 10 *
27 * @return string[] 28 * @return string[]
28 * The merged array of cache contexts. 29 * The merged array of cache contexts.
29 */ 30 */
30 public static function mergeContexts(array $a = [], array $b = []) { 31 public static function mergeContexts(array $a = [], array $b = []) {
31 $cache_contexts = array_unique(array_merge($a, $b)); 32 $cache_contexts = array_unique(array_merge($a, $b));
32 assert('\Drupal::service(\'cache_contexts_manager\')->assertValidTokens($cache_contexts)'); 33 assert(\Drupal::service('cache_contexts_manager')->assertValidTokens($cache_contexts));
33 sort($cache_contexts); 34 sort($cache_contexts);
34 return $cache_contexts; 35 return $cache_contexts;
35 } 36 }
36 37
37 /** 38 /**
52 * 53 *
53 * @return string[] 54 * @return string[]
54 * The merged array of cache tags. 55 * The merged array of cache tags.
55 */ 56 */
56 public static function mergeTags(array $a = [], array $b = []) { 57 public static function mergeTags(array $a = [], array $b = []) {
57 assert('\Drupal\Component\Assertion\Inspector::assertAllStrings($a) && \Drupal\Component\Assertion\Inspector::assertAllStrings($b)', 'Cache tags must be valid strings'); 58 assert(Inspector::assertAllStrings($a) && Inspector::assertAllStrings($b), 'Cache tags must be valid strings');
58 59
59 $cache_tags = array_unique(array_merge($a, $b)); 60 $cache_tags = array_unique(array_merge($a, $b));
60 sort($cache_tags); 61 sort($cache_tags);
61 return $cache_tags; 62 return $cache_tags;
62 } 63 }
94 * 95 *
95 * @param string[] $tags 96 * @param string[] $tags
96 * An array of cache tags. 97 * An array of cache tags.
97 * 98 *
98 * @deprecated 99 * @deprecated
99 * Use assert('\Drupal\Component\Assertion\Inspector::assertAllStrings($tags)'); 100 * Use assert(Inspector::assertAllStrings($tags));
100 * 101 *
101 * @throws \LogicException 102 * @throws \LogicException
102 */ 103 */
103 public static function validateTags(array $tags) { 104 public static function validateTags(array $tags) {
104 if (empty($tags)) { 105 if (empty($tags)) {