From 8305be48fcb622b74053e8cc2cfc58af0a29977e Mon Sep 17 00:00:00 2001 From: xjm <xjm@65776.no-reply.drupal.org> Date: Tue, 16 Jun 2015 13:51:07 -0500 Subject: [PATCH] Issue #2483781 by borisson_, rbayliss, cilefen, mitalimehta, joshi.rohit100: Move cache contexts classes from \Drupal\Core\Cache to \Drupal\Core\Cache\Context --- core/core.services.yml | 38 +++++++++---------- core/lib/Drupal/Core/Access/AccessResult.php | 4 +- .../Cache/CacheableDependencyInterface.php | 2 +- .../AccountPermissionsCacheContext.php | 4 +- .../{ => Context}/CacheContextInterface.php | 4 +- .../{ => Context}/CacheContextsManager.php | 14 +++---- .../Cache/{ => Context}/CacheContextsPass.php | 4 +- .../CalculatedCacheContextInterface.php | 4 +- .../{ => Context}/CookiesCacheContext.php | 4 +- .../{ => Context}/HeadersCacheContext.php | 4 +- .../Cache/{ => Context}/IpCacheContext.php | 4 +- .../{ => Context}/IsSuperUserCacheContext.php | 4 +- .../{ => Context}/LanguagesCacheContext.php | 4 +- .../MenuActiveTrailsCacheContext.php | 4 +- .../{ => Context}/PagersCacheContext.php | 4 +- .../{ => Context}/QueryArgsCacheContext.php | 4 +- .../RequestFormatCacheContext.php | 4 +- .../RequestStackCacheContextBase.php | 4 +- .../Cache/{ => Context}/RouteCacheContext.php | 4 +- .../{ => Context}/RouteNameCacheContext.php | 4 +- .../Cache/{ => Context}/SiteCacheContext.php | 4 +- .../Cache/{ => Context}/ThemeCacheContext.php | 4 +- .../{ => Context}/TimeZoneCacheContext.php | 4 +- .../Cache/{ => Context}/UrlCacheContext.php | 4 +- .../Cache/{ => Context}/UserCacheContext.php | 4 +- .../{ => Context}/UserRolesCacheContext.php | 4 +- core/lib/Drupal/Core/CoreServiceProvider.php | 2 +- .../FinishResponseSubscriber.php | 6 +-- core/lib/Drupal/Core/Render/RenderCache.php | 6 +-- .../block/src/Tests/BlockViewBuilderTest.php | 2 +- .../src/Cache/BookNavigationCacheContext.php | 2 +- .../src/Unit/LanguageNegotiationUrlTest.php | 2 +- .../Cache/NodeAccessGrantsCacheContext.php | 4 +- .../EntityTestViewGrantsCacheContext.php | 2 +- .../tests/src/Unit/Menu/MenuLinkTreeTest.php | 2 +- .../src/Cache/ViewsTestCacheContext.php | 2 +- .../Core/Cache/CacheableMetadataTest.php | 2 +- .../CacheContextsManagerTest.php | 10 ++--- .../Core/Render/BubbleableMetadataTest.php | 2 +- .../Tests/Core/Render/RendererTestBase.php | 4 +- .../Tests/Core/Routing/UrlGeneratorTest.php | 2 +- 41 files changed, 98 insertions(+), 98 deletions(-) rename core/lib/Drupal/Core/Cache/{ => Context}/AccountPermissionsCacheContext.php (92%) rename core/lib/Drupal/Core/Cache/{ => Context}/CacheContextInterface.php (86%) rename core/lib/Drupal/Core/Cache/{ => Context}/CacheContextsManager.php (95%) rename core/lib/Drupal/Core/Cache/{ => Context}/CacheContextsPass.php (94%) rename core/lib/Drupal/Core/Cache/{ => Context}/CalculatedCacheContextInterface.php (90%) rename core/lib/Drupal/Core/Cache/{ => Context}/CookiesCacheContext.php (86%) rename core/lib/Drupal/Core/Cache/{ => Context}/HeadersCacheContext.php (86%) rename core/lib/Drupal/Core/Cache/{ => Context}/IpCacheContext.php (81%) rename core/lib/Drupal/Core/Cache/{ => Context}/IsSuperUserCacheContext.php (80%) rename core/lib/Drupal/Core/Cache/{ => Context}/LanguagesCacheContext.php (95%) rename core/lib/Drupal/Core/Cache/{ => Context}/MenuActiveTrailsCacheContext.php (87%) rename core/lib/Drupal/Core/Cache/{ => Context}/PagersCacheContext.php (88%) rename core/lib/Drupal/Core/Cache/{ => Context}/QueryArgsCacheContext.php (88%) rename core/lib/Drupal/Core/Cache/{ => Context}/RequestFormatCacheContext.php (80%) rename core/lib/Drupal/Core/Cache/{ => Context}/RequestStackCacheContextBase.php (86%) rename core/lib/Drupal/Core/Cache/{ => Context}/RouteCacheContext.php (90%) rename core/lib/Drupal/Core/Cache/{ => Context}/RouteNameCacheContext.php (79%) rename core/lib/Drupal/Core/Cache/{ => Context}/SiteCacheContext.php (90%) rename core/lib/Drupal/Core/Cache/{ => Context}/ThemeCacheContext.php (90%) rename core/lib/Drupal/Core/Cache/{ => Context}/TimeZoneCacheContext.php (85%) rename core/lib/Drupal/Core/Cache/{ => Context}/UrlCacheContext.php (80%) rename core/lib/Drupal/Core/Cache/{ => Context}/UserCacheContext.php (87%) rename core/lib/Drupal/Core/Cache/{ => Context}/UserRolesCacheContext.php (85%) rename core/tests/Drupal/Tests/Core/Cache/{ => Context}/CacheContextsManagerTest.php (96%) diff --git a/core/core.services.yml b/core/core.services.yml index 77173cd2ffe0..5a9cd6e0454c 100644 --- a/core/core.services.yml +++ b/core/core.services.yml @@ -10,59 +10,59 @@ parameters: services: # Simple cache contexts, directly derived from the request context. cache_context.ip: - class: Drupal\Core\Cache\IpCacheContext + class: Drupal\Core\Cache\Context\IpCacheContext arguments: ['@request_stack'] tags: - { name: cache.context } cache_context.headers: - class: Drupal\Core\Cache\HeadersCacheContext + class: Drupal\Core\Cache\Context\HeadersCacheContext arguments: ['@request_stack'] tags: - { name: cache.context } cache_context.cookies: - class: Drupal\Core\Cache\CookiesCacheContext + class: Drupal\Core\Cache\Context\CookiesCacheContext arguments: ['@request_stack'] tags: - { name: cache.context } cache_context.request_format: - class: Drupal\Core\Cache\RequestFormatCacheContext + class: Drupal\Core\Cache\Context\RequestFormatCacheContext arguments: ['@request_stack'] tags: - { name: cache.context } cache_context.url: - class: Drupal\Core\Cache\UrlCacheContext + class: Drupal\Core\Cache\Context\UrlCacheContext arguments: ['@request_stack'] tags: - { name: cache.context } cache_context.url.site: - class: Drupal\Core\Cache\SiteCacheContext + class: Drupal\Core\Cache\Context\SiteCacheContext arguments: ['@request_stack'] tags: - { name: cache.context } cache_context.url.query_args: - class: Drupal\Core\Cache\QueryArgsCacheContext + class: Drupal\Core\Cache\Context\QueryArgsCacheContext arguments: ['@request_stack'] tags: - { name: cache.context } cache_context.url.query_args.pagers: - class: Drupal\Core\Cache\PagersCacheContext + class: Drupal\Core\Cache\Context\PagersCacheContext arguments: ['@request_stack'] tags: - { name: cache.context } # Complex cache contexts, that depend on the routing system. cache_context.route: - class: Drupal\Core\Cache\RouteCacheContext + class: Drupal\Core\Cache\Context\RouteCacheContext arguments: ['@current_route_match'] tags: - { name: cache.context } cache_context.route.name: - class: Drupal\Core\Cache\RouteNameCacheContext + class: Drupal\Core\Cache\Context\RouteNameCacheContext arguments: ['@current_route_match'] tags: - { name: cache.context } cache_context.route.menu_active_trails: - class: Drupal\Core\Cache\MenuActiveTrailsCacheContext + class: Drupal\Core\Cache\Context\MenuActiveTrailsCacheContext calls: - [setContainer, ['@service_container']] tags: @@ -72,37 +72,37 @@ services: # multiple aspects of the request context plus additional logic. Hence they # are their own roots. cache_context.user: - class: Drupal\Core\Cache\UserCacheContext + class: Drupal\Core\Cache\Context\UserCacheContext arguments: ['@current_user'] tags: - { name: cache.context} cache_context.user.permissions: - class: Drupal\Core\Cache\AccountPermissionsCacheContext + class: Drupal\Core\Cache\Context\AccountPermissionsCacheContext arguments: ['@current_user', '@user_permissions_hash_generator'] tags: - { name: cache.context} cache_context.user.roles: - class: Drupal\Core\Cache\UserRolesCacheContext + class: Drupal\Core\Cache\Context\UserRolesCacheContext arguments: ['@current_user'] tags: - { name: cache.context} cache_context.user.is_super_user: - class: Drupal\Core\Cache\IsSuperUserCacheContext + class: Drupal\Core\Cache\Context\IsSuperUserCacheContext arguments: ['@current_user'] tags: - { name: cache.context} cache_context.languages: - class: Drupal\Core\Cache\LanguagesCacheContext + class: Drupal\Core\Cache\Context\LanguagesCacheContext arguments: ['@language_manager'] tags: - { name: cache.context} cache_context.theme: - class: Drupal\Core\Cache\ThemeCacheContext + class: Drupal\Core\Cache\Context\ThemeCacheContext arguments: ['@theme.manager'] tags: - { name: cache.context} cache_context.timezone: - class: Drupal\Core\Cache\TimeZoneCacheContext + class: Drupal\Core\Cache\Context\TimeZoneCacheContext tags: - { name: cache.context} @@ -112,7 +112,7 @@ services: calls: - [setContainer, ['@service_container']] cache_contexts_manager: - class: Drupal\Core\Cache\CacheContextsManager + class: Drupal\Core\Cache\Context\CacheContextsManager arguments: ['@service_container', '%cache_contexts%' ] cache_tags.invalidator: parent: container.trait diff --git a/core/lib/Drupal/Core/Access/AccessResult.php b/core/lib/Drupal/Core/Access/AccessResult.php index 24d5051033d1..9c4e42f6f243 100644 --- a/core/lib/Drupal/Core/Access/AccessResult.php +++ b/core/lib/Drupal/Core/Access/AccessResult.php @@ -31,8 +31,8 @@ abstract class AccessResult implements AccessResultInterface, CacheableDependenc /** * The cache context IDs (to vary a cache item ID based on active contexts). * - * @see \Drupal\Core\Cache\CacheContextInterface - * @see \Drupal\Core\Cache\CacheContextsManager::convertTokensToKeys() + * @see \Drupal\Core\Cache\Context\CacheContextInterface + * @see \Drupal\Core\Cache\Context\CacheContextsManager::convertTokensToKeys() * * @var string[] */ diff --git a/core/lib/Drupal/Core/Cache/CacheableDependencyInterface.php b/core/lib/Drupal/Core/Cache/CacheableDependencyInterface.php index f415064e8eb3..ee1241ba0c5f 100644 --- a/core/lib/Drupal/Core/Cache/CacheableDependencyInterface.php +++ b/core/lib/Drupal/Core/Cache/CacheableDependencyInterface.php @@ -31,7 +31,7 @@ interface CacheableDependencyInterface { * @return string[] * An array of cache context tokens, used to generate a cache ID. * - * @see \Drupal\Core\Cache\CacheContextsManager::convertTokensToKeys() + * @see \Drupal\Core\Cache\Context\CacheContextsManager::convertTokensToKeys() */ public function getCacheContexts(); diff --git a/core/lib/Drupal/Core/Cache/AccountPermissionsCacheContext.php b/core/lib/Drupal/Core/Cache/Context/AccountPermissionsCacheContext.php similarity index 92% rename from core/lib/Drupal/Core/Cache/AccountPermissionsCacheContext.php rename to core/lib/Drupal/Core/Cache/Context/AccountPermissionsCacheContext.php index 3352ecafdf82..7afce732b3a3 100644 --- a/core/lib/Drupal/Core/Cache/AccountPermissionsCacheContext.php +++ b/core/lib/Drupal/Core/Cache/Context/AccountPermissionsCacheContext.php @@ -2,10 +2,10 @@ /** * @file - * Contains \Drupal\Core\Cache\UserRolesCacheContext. + * Contains \Drupal\Core\Cache\Context\UserRolesCacheContext. */ -namespace Drupal\Core\Cache; +namespace Drupal\Core\Cache\Context; use Drupal\Core\Session\AccountInterface; use Drupal\Core\Session\PermissionsHashGeneratorInterface; diff --git a/core/lib/Drupal/Core/Cache/CacheContextInterface.php b/core/lib/Drupal/Core/Cache/Context/CacheContextInterface.php similarity index 86% rename from core/lib/Drupal/Core/Cache/CacheContextInterface.php rename to core/lib/Drupal/Core/Cache/Context/CacheContextInterface.php index fd9783a0852a..ada317473416 100644 --- a/core/lib/Drupal/Core/Cache/CacheContextInterface.php +++ b/core/lib/Drupal/Core/Cache/Context/CacheContextInterface.php @@ -2,10 +2,10 @@ /** * @file - * Contains \Drupal\Core\Cache\CacheContextInterface. + * Contains \Drupal\Core\Cache\Context\CacheContextInterface. */ -namespace Drupal\Core\Cache; +namespace Drupal\Core\Cache\Context; /** * Provides an interface for defining a cache context service. diff --git a/core/lib/Drupal/Core/Cache/CacheContextsManager.php b/core/lib/Drupal/Core/Cache/Context/CacheContextsManager.php similarity index 95% rename from core/lib/Drupal/Core/Cache/CacheContextsManager.php rename to core/lib/Drupal/Core/Cache/Context/CacheContextsManager.php index 67857cbfc118..27b012a9e49d 100644 --- a/core/lib/Drupal/Core/Cache/CacheContextsManager.php +++ b/core/lib/Drupal/Core/Cache/Context/CacheContextsManager.php @@ -2,10 +2,10 @@ /** * @file - * Contains \Drupal\Core\Cache\CacheContextsManager. + * Contains \Drupal\Core\Cache\Context\CacheContextsManager. */ -namespace Drupal\Core\Cache; +namespace Drupal\Core\Cache\Context; use Drupal\Component\Utility\SafeMarkup; use Symfony\Component\DependencyInjection\ContainerInterface; @@ -21,9 +21,9 @@ * Note that this maps exactly to HTTP's Vary header semantics: * @link http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.44 * - * @see \Drupal\Core\Cache\CacheContextInterface - * @see \Drupal\Core\Cache\CalculatedCacheContextInterface - * @see \Drupal\Core\Cache\CacheContextsPass + * @see \Drupal\Core\Cache\Context\CacheContextInterface + * @see \Drupal\Core\Cache\Context\CalculatedCacheContextInterface + * @see \Drupal\Core\Cache\Context\CacheContextsPass */ class CacheContextsManager { @@ -188,7 +188,7 @@ public function optimizeTokens(array $context_tokens) { * The context ID, which together with the service ID prefix allows the * corresponding cache context service to be retrieved. * - * @return \Drupal\Core\Cache\CacheContextInterface + * @return \Drupal\Core\Cache\Context\CacheContextInterface * The requested cache context service. */ protected function getService($context_id) { @@ -231,7 +231,7 @@ public static function parseTokens(array $context_tokens) { * * @throws \LogicException * - * @see \Drupal\Core\Cache\CacheContextsManager::parseTokens() + * @see \Drupal\Core\Cache\Context\CacheContextsManager::parseTokens() */ public function validateTokens(array $context_tokens = []) { if (empty($context_tokens)) { diff --git a/core/lib/Drupal/Core/Cache/CacheContextsPass.php b/core/lib/Drupal/Core/Cache/Context/CacheContextsPass.php similarity index 94% rename from core/lib/Drupal/Core/Cache/CacheContextsPass.php rename to core/lib/Drupal/Core/Cache/Context/CacheContextsPass.php index 576b2b568fca..ce8e2f4be8a8 100644 --- a/core/lib/Drupal/Core/Cache/CacheContextsPass.php +++ b/core/lib/Drupal/Core/Cache/Context/CacheContextsPass.php @@ -2,10 +2,10 @@ /** * @file - * Contains \Drupal\Core\Cache\CacheContextsPass. + * Contains \Drupal\Core\Cache\Context\CacheContextsPass. */ -namespace Drupal\Core\Cache; +namespace Drupal\Core\Cache\Context; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; diff --git a/core/lib/Drupal/Core/Cache/CalculatedCacheContextInterface.php b/core/lib/Drupal/Core/Cache/Context/CalculatedCacheContextInterface.php similarity index 90% rename from core/lib/Drupal/Core/Cache/CalculatedCacheContextInterface.php rename to core/lib/Drupal/Core/Cache/Context/CalculatedCacheContextInterface.php index 38114c363cf5..4242109227ee 100644 --- a/core/lib/Drupal/Core/Cache/CalculatedCacheContextInterface.php +++ b/core/lib/Drupal/Core/Cache/Context/CalculatedCacheContextInterface.php @@ -2,10 +2,10 @@ /** * @file - * Contains \Drupal\Core\Cache\CacheContextInterface. + * Contains \Drupal\Core\Cache\Context\CacheContextInterface. */ -namespace Drupal\Core\Cache; +namespace Drupal\Core\Cache\Context; /** * Provides an interface for defining a calculated cache context service. diff --git a/core/lib/Drupal/Core/Cache/CookiesCacheContext.php b/core/lib/Drupal/Core/Cache/Context/CookiesCacheContext.php similarity index 86% rename from core/lib/Drupal/Core/Cache/CookiesCacheContext.php rename to core/lib/Drupal/Core/Cache/Context/CookiesCacheContext.php index 6760b1b5c5a6..e7850b8c8cbc 100644 --- a/core/lib/Drupal/Core/Cache/CookiesCacheContext.php +++ b/core/lib/Drupal/Core/Cache/Context/CookiesCacheContext.php @@ -2,10 +2,10 @@ /** * @file - * Contains \Drupal\Core\Cache\CookiesCacheContext. + * Contains \Drupal\Core\Cache\Context\CookiesCacheContext. */ -namespace Drupal\Core\Cache; +namespace Drupal\Core\Cache\Context; /** * Defines the CookiesCacheContext service, for "per cookie" caching. diff --git a/core/lib/Drupal/Core/Cache/HeadersCacheContext.php b/core/lib/Drupal/Core/Cache/Context/HeadersCacheContext.php similarity index 86% rename from core/lib/Drupal/Core/Cache/HeadersCacheContext.php rename to core/lib/Drupal/Core/Cache/Context/HeadersCacheContext.php index e2b8932dab24..1644aa09c842 100644 --- a/core/lib/Drupal/Core/Cache/HeadersCacheContext.php +++ b/core/lib/Drupal/Core/Cache/Context/HeadersCacheContext.php @@ -2,10 +2,10 @@ /** * @file - * Contains \Drupal\Core\Cache\HeadersCacheContext. + * Contains \Drupal\Core\Cache\Context\HeadersCacheContext. */ -namespace Drupal\Core\Cache; +namespace Drupal\Core\Cache\Context; /** * Defines the HeadersCacheContext service, for "per header" caching. diff --git a/core/lib/Drupal/Core/Cache/IpCacheContext.php b/core/lib/Drupal/Core/Cache/Context/IpCacheContext.php similarity index 81% rename from core/lib/Drupal/Core/Cache/IpCacheContext.php rename to core/lib/Drupal/Core/Cache/Context/IpCacheContext.php index c0c2e08020fb..4841482f6bae 100644 --- a/core/lib/Drupal/Core/Cache/IpCacheContext.php +++ b/core/lib/Drupal/Core/Cache/Context/IpCacheContext.php @@ -2,10 +2,10 @@ /** * @file - * Contains \Drupal\Core\Cache\IpCacheContext. + * Contains \Drupal\Core\Cache\Context\IpCacheContext. */ -namespace Drupal\Core\Cache; +namespace Drupal\Core\Cache\Context; /** * Defines the IpCacheContext service, for "per IP address" caching. diff --git a/core/lib/Drupal/Core/Cache/IsSuperUserCacheContext.php b/core/lib/Drupal/Core/Cache/Context/IsSuperUserCacheContext.php similarity index 80% rename from core/lib/Drupal/Core/Cache/IsSuperUserCacheContext.php rename to core/lib/Drupal/Core/Cache/Context/IsSuperUserCacheContext.php index 65697155357f..3f27059638d0 100644 --- a/core/lib/Drupal/Core/Cache/IsSuperUserCacheContext.php +++ b/core/lib/Drupal/Core/Cache/Context/IsSuperUserCacheContext.php @@ -2,10 +2,10 @@ /** * @file - * Contains \Drupal\Core\Cache\IsSuperUserCacheContext. + * Contains \Drupal\Core\Cache\Context\IsSuperUserCacheContext. */ -namespace Drupal\Core\Cache; +namespace Drupal\Core\Cache\Context; /** * Defines the IsSuperUserCacheContext service, for "super user or not" caching. diff --git a/core/lib/Drupal/Core/Cache/LanguagesCacheContext.php b/core/lib/Drupal/Core/Cache/Context/LanguagesCacheContext.php similarity index 95% rename from core/lib/Drupal/Core/Cache/LanguagesCacheContext.php rename to core/lib/Drupal/Core/Cache/Context/LanguagesCacheContext.php index b9b888345d01..2bf9a2f68c3c 100644 --- a/core/lib/Drupal/Core/Cache/LanguagesCacheContext.php +++ b/core/lib/Drupal/Core/Cache/Context/LanguagesCacheContext.php @@ -2,10 +2,10 @@ /** * @file - * Contains \Drupal\Core\Cache\LanguagesCacheContext. + * Contains \Drupal\Core\Cache\Context\LanguagesCacheContext. */ -namespace Drupal\Core\Cache; +namespace Drupal\Core\Cache\Context; use Drupal\Core\Language\LanguageManagerInterface; diff --git a/core/lib/Drupal/Core/Cache/MenuActiveTrailsCacheContext.php b/core/lib/Drupal/Core/Cache/Context/MenuActiveTrailsCacheContext.php similarity index 87% rename from core/lib/Drupal/Core/Cache/MenuActiveTrailsCacheContext.php rename to core/lib/Drupal/Core/Cache/Context/MenuActiveTrailsCacheContext.php index 3b43178a31b8..40cc077b5aa7 100644 --- a/core/lib/Drupal/Core/Cache/MenuActiveTrailsCacheContext.php +++ b/core/lib/Drupal/Core/Cache/Context/MenuActiveTrailsCacheContext.php @@ -2,10 +2,10 @@ /** * @file - * Contains \Drupal\Core\Cache\MenuActiveTrailsCacheContext. + * Contains \Drupal\Core\Cache\Context\MenuActiveTrailsCacheContext. */ -namespace Drupal\Core\Cache; +namespace Drupal\Core\Cache\Context; use Symfony\Component\DependencyInjection\ContainerAware; diff --git a/core/lib/Drupal/Core/Cache/PagersCacheContext.php b/core/lib/Drupal/Core/Cache/Context/PagersCacheContext.php similarity index 88% rename from core/lib/Drupal/Core/Cache/PagersCacheContext.php rename to core/lib/Drupal/Core/Cache/Context/PagersCacheContext.php index cd9bb98895e3..23bdb7c99dc5 100644 --- a/core/lib/Drupal/Core/Cache/PagersCacheContext.php +++ b/core/lib/Drupal/Core/Cache/Context/PagersCacheContext.php @@ -2,10 +2,10 @@ /** * @file - * Contains \Drupal\Core\Cache\PagersCacheContext. + * Contains \Drupal\Core\Cache\Context\PagersCacheContext. */ -namespace Drupal\Core\Cache; +namespace Drupal\Core\Cache\Context; /** * Defines a cache context for "per page in a pager" caching. diff --git a/core/lib/Drupal/Core/Cache/QueryArgsCacheContext.php b/core/lib/Drupal/Core/Cache/Context/QueryArgsCacheContext.php similarity index 88% rename from core/lib/Drupal/Core/Cache/QueryArgsCacheContext.php rename to core/lib/Drupal/Core/Cache/Context/QueryArgsCacheContext.php index 4c34721d74d7..e9a76649836c 100644 --- a/core/lib/Drupal/Core/Cache/QueryArgsCacheContext.php +++ b/core/lib/Drupal/Core/Cache/Context/QueryArgsCacheContext.php @@ -2,10 +2,10 @@ /** * @file - * Contains \Drupal\Core\Cache\QueryArgsCacheContext. + * Contains \Drupal\Core\Cache\Context\QueryArgsCacheContext. */ -namespace Drupal\Core\Cache; +namespace Drupal\Core\Cache\Context; /** * Defines the QueryArgsCacheContext service, for "per query args" caching. diff --git a/core/lib/Drupal/Core/Cache/RequestFormatCacheContext.php b/core/lib/Drupal/Core/Cache/Context/RequestFormatCacheContext.php similarity index 80% rename from core/lib/Drupal/Core/Cache/RequestFormatCacheContext.php rename to core/lib/Drupal/Core/Cache/Context/RequestFormatCacheContext.php index 397384fbcf7c..c3e544d83490 100644 --- a/core/lib/Drupal/Core/Cache/RequestFormatCacheContext.php +++ b/core/lib/Drupal/Core/Cache/Context/RequestFormatCacheContext.php @@ -2,10 +2,10 @@ /** * @file - * Contains \Drupal\Core\Cache\RequestFormatCacheContext. + * Contains \Drupal\Core\Cache\Context\RequestFormatCacheContext. */ -namespace Drupal\Core\Cache; +namespace Drupal\Core\Cache\Context; /** * Defines the RequestFormatCacheContext service, for "per format" caching. diff --git a/core/lib/Drupal/Core/Cache/RequestStackCacheContextBase.php b/core/lib/Drupal/Core/Cache/Context/RequestStackCacheContextBase.php similarity index 86% rename from core/lib/Drupal/Core/Cache/RequestStackCacheContextBase.php rename to core/lib/Drupal/Core/Cache/Context/RequestStackCacheContextBase.php index 34e3560c2ba5..2a8f22d1f980 100644 --- a/core/lib/Drupal/Core/Cache/RequestStackCacheContextBase.php +++ b/core/lib/Drupal/Core/Cache/Context/RequestStackCacheContextBase.php @@ -2,10 +2,10 @@ /** * @file - * Contains \Drupal\Core\Cache\RequestStackCacheContextBase. + * Contains \Drupal\Core\Cache\Context\RequestStackCacheContextBase. */ -namespace Drupal\Core\Cache; +namespace Drupal\Core\Cache\Context; use Symfony\Component\HttpFoundation\RequestStack; diff --git a/core/lib/Drupal/Core/Cache/RouteCacheContext.php b/core/lib/Drupal/Core/Cache/Context/RouteCacheContext.php similarity index 90% rename from core/lib/Drupal/Core/Cache/RouteCacheContext.php rename to core/lib/Drupal/Core/Cache/Context/RouteCacheContext.php index 486cdefe3274..0643d8bf0ffd 100644 --- a/core/lib/Drupal/Core/Cache/RouteCacheContext.php +++ b/core/lib/Drupal/Core/Cache/Context/RouteCacheContext.php @@ -2,10 +2,10 @@ /** * @file - * Contains \Drupal\Core\Cache\RouteCacheContext. + * Contains \Drupal\Core\Cache\Context\RouteCacheContext. */ -namespace Drupal\Core\Cache; +namespace Drupal\Core\Cache\Context; use Drupal\Core\Routing\RouteMatchInterface; diff --git a/core/lib/Drupal/Core/Cache/RouteNameCacheContext.php b/core/lib/Drupal/Core/Cache/Context/RouteNameCacheContext.php similarity index 79% rename from core/lib/Drupal/Core/Cache/RouteNameCacheContext.php rename to core/lib/Drupal/Core/Cache/Context/RouteNameCacheContext.php index f0bd93788108..dcca18b8ff18 100644 --- a/core/lib/Drupal/Core/Cache/RouteNameCacheContext.php +++ b/core/lib/Drupal/Core/Cache/Context/RouteNameCacheContext.php @@ -2,10 +2,10 @@ /** * @file - * Contains \Drupal\Core\Cache\RouteNameCacheContext. + * Contains \Drupal\Core\Cache\Context\RouteNameCacheContext. */ -namespace Drupal\Core\Cache; +namespace Drupal\Core\Cache\Context; /** * Defines the RouteCacheContext service, for "per route name" caching. diff --git a/core/lib/Drupal/Core/Cache/SiteCacheContext.php b/core/lib/Drupal/Core/Cache/Context/SiteCacheContext.php similarity index 90% rename from core/lib/Drupal/Core/Cache/SiteCacheContext.php rename to core/lib/Drupal/Core/Cache/Context/SiteCacheContext.php index febbc0ed0f27..4e0c123f5119 100644 --- a/core/lib/Drupal/Core/Cache/SiteCacheContext.php +++ b/core/lib/Drupal/Core/Cache/Context/SiteCacheContext.php @@ -2,10 +2,10 @@ /** * @file - * Contains \Drupal\Core\Cache\SiteCacheContext. + * Contains \Drupal\Core\Cache\Context\SiteCacheContext. */ -namespace Drupal\Core\Cache; +namespace Drupal\Core\Cache\Context; /** * Defines the SiteCacheContext service, for "per site" caching. diff --git a/core/lib/Drupal/Core/Cache/ThemeCacheContext.php b/core/lib/Drupal/Core/Cache/Context/ThemeCacheContext.php similarity index 90% rename from core/lib/Drupal/Core/Cache/ThemeCacheContext.php rename to core/lib/Drupal/Core/Cache/Context/ThemeCacheContext.php index ad0249acc6e2..5f478ec7049b 100644 --- a/core/lib/Drupal/Core/Cache/ThemeCacheContext.php +++ b/core/lib/Drupal/Core/Cache/Context/ThemeCacheContext.php @@ -2,10 +2,10 @@ /** * @file - * Contains \Drupal\Core\Cache\LanguageCacheContext. + * Contains \Drupal\Core\Cache\Context\LanguageCacheContext. */ -namespace Drupal\Core\Cache; +namespace Drupal\Core\Cache\Context; use Drupal\Core\Routing\RouteMatchInterface; use Drupal\Core\Theme\ThemeManagerInterface; diff --git a/core/lib/Drupal/Core/Cache/TimeZoneCacheContext.php b/core/lib/Drupal/Core/Cache/Context/TimeZoneCacheContext.php similarity index 85% rename from core/lib/Drupal/Core/Cache/TimeZoneCacheContext.php rename to core/lib/Drupal/Core/Cache/Context/TimeZoneCacheContext.php index ae0621c48b5b..7e5b7c5c94d9 100644 --- a/core/lib/Drupal/Core/Cache/TimeZoneCacheContext.php +++ b/core/lib/Drupal/Core/Cache/Context/TimeZoneCacheContext.php @@ -2,10 +2,10 @@ /** * @file - * Contains \Drupal\Core\Cache\TimeZoneCacheContext. + * Contains \Drupal\Core\Cache\Context\TimeZoneCacheContext. */ -namespace Drupal\Core\Cache; +namespace Drupal\Core\Cache\Context; /** * Defines the TimeZoneCacheContext service, for "per time zone" caching. diff --git a/core/lib/Drupal/Core/Cache/UrlCacheContext.php b/core/lib/Drupal/Core/Cache/Context/UrlCacheContext.php similarity index 80% rename from core/lib/Drupal/Core/Cache/UrlCacheContext.php rename to core/lib/Drupal/Core/Cache/Context/UrlCacheContext.php index 138109317d38..1ea0bf03ebdf 100644 --- a/core/lib/Drupal/Core/Cache/UrlCacheContext.php +++ b/core/lib/Drupal/Core/Cache/Context/UrlCacheContext.php @@ -2,10 +2,10 @@ /** * @file - * Contains \Drupal\Core\Cache\UrlCacheContext. + * Contains \Drupal\Core\Cache\Context\UrlCacheContext. */ -namespace Drupal\Core\Cache; +namespace Drupal\Core\Cache\Context; /** * Defines the UrlCacheContext service, for "per page" caching. diff --git a/core/lib/Drupal/Core/Cache/UserCacheContext.php b/core/lib/Drupal/Core/Cache/Context/UserCacheContext.php similarity index 87% rename from core/lib/Drupal/Core/Cache/UserCacheContext.php rename to core/lib/Drupal/Core/Cache/Context/UserCacheContext.php index d5e282553979..80ad5191e60f 100644 --- a/core/lib/Drupal/Core/Cache/UserCacheContext.php +++ b/core/lib/Drupal/Core/Cache/Context/UserCacheContext.php @@ -2,10 +2,10 @@ /** * @file - * Contains \Drupal\Core\Cache\UserCacheContext. + * Contains \Drupal\Core\Cache\Context\UserCacheContext. */ -namespace Drupal\Core\Cache; +namespace Drupal\Core\Cache\Context; use Drupal\Core\Session\AccountInterface; diff --git a/core/lib/Drupal/Core/Cache/UserRolesCacheContext.php b/core/lib/Drupal/Core/Cache/Context/UserRolesCacheContext.php similarity index 85% rename from core/lib/Drupal/Core/Cache/UserRolesCacheContext.php rename to core/lib/Drupal/Core/Cache/Context/UserRolesCacheContext.php index cf7b4507b0f2..375d80bb0d9d 100644 --- a/core/lib/Drupal/Core/Cache/UserRolesCacheContext.php +++ b/core/lib/Drupal/Core/Cache/Context/UserRolesCacheContext.php @@ -2,10 +2,10 @@ /** * @file - * Contains \Drupal\Core\Cache\UserRolesCacheContext. + * Contains \Drupal\Core\Cache\Context\UserRolesCacheContext. */ -namespace Drupal\Core\Cache; +namespace Drupal\Core\Cache\Context; /** * Defines the UserRolesCacheContext service, for "per role" caching. diff --git a/core/lib/Drupal/Core/CoreServiceProvider.php b/core/lib/Drupal/Core/CoreServiceProvider.php index 75d8ec582611..64a9aee1bc6b 100644 --- a/core/lib/Drupal/Core/CoreServiceProvider.php +++ b/core/lib/Drupal/Core/CoreServiceProvider.php @@ -7,7 +7,7 @@ namespace Drupal\Core; -use Drupal\Core\Cache\CacheContextsPass; +use Drupal\Core\Cache\Context\CacheContextsPass; use Drupal\Core\Cache\ListCacheBinsPass; use Drupal\Core\DependencyInjection\Compiler\BackendCompilerPass; use Drupal\Core\DependencyInjection\Compiler\RegisterLazyRouteEnhancers; diff --git a/core/lib/Drupal/Core/EventSubscriber/FinishResponseSubscriber.php b/core/lib/Drupal/Core/EventSubscriber/FinishResponseSubscriber.php index bee69a151c4a..944653a389a7 100644 --- a/core/lib/Drupal/Core/EventSubscriber/FinishResponseSubscriber.php +++ b/core/lib/Drupal/Core/EventSubscriber/FinishResponseSubscriber.php @@ -9,7 +9,7 @@ use Drupal\Component\Datetime\DateTimePlus; use Drupal\Core\Cache\CacheableResponseInterface; -use Drupal\Core\Cache\CacheContextsManager; +use Drupal\Core\Cache\Context\CacheContextsManager; use Drupal\Core\Config\Config; use Drupal\Core\Config\ConfigFactoryInterface; use Drupal\Core\Language\LanguageManagerInterface; @@ -61,7 +61,7 @@ class FinishResponseSubscriber implements EventSubscriberInterface { /** * The cache contexts manager service. * - * @var \Drupal\Core\Cache\CacheContextsManager + * @var \Drupal\Core\Cache\Context\CacheContextsManager */ protected $cacheContexts; @@ -76,7 +76,7 @@ class FinishResponseSubscriber implements EventSubscriberInterface { * A policy rule determining the cacheability of a request. * @param \Drupal\Core\PageCache\ResponsePolicyInterface $response_policy * A policy rule determining the cacheability of a response. - * @param \Drupal\Core\Cache\CacheContextsManager $cache_contexts_manager + * @param \Drupal\Core\Cache\Context\CacheContextsManager $cache_contexts_manager * The cache contexts manager service. */ public function __construct(LanguageManagerInterface $language_manager, ConfigFactoryInterface $config_factory, RequestPolicyInterface $request_policy, ResponsePolicyInterface $response_policy, CacheContextsManager $cache_contexts_manager) { diff --git a/core/lib/Drupal/Core/Render/RenderCache.php b/core/lib/Drupal/Core/Render/RenderCache.php index cba983d434f7..776bfd49ad55 100644 --- a/core/lib/Drupal/Core/Render/RenderCache.php +++ b/core/lib/Drupal/Core/Render/RenderCache.php @@ -8,7 +8,7 @@ namespace Drupal\Core\Render; use Drupal\Core\Cache\Cache; -use Drupal\Core\Cache\CacheContextsManager; +use Drupal\Core\Cache\Context\CacheContextsManager; use Drupal\Core\Cache\CacheFactoryInterface; use Symfony\Component\HttpFoundation\RequestStack; @@ -34,7 +34,7 @@ class RenderCache implements RenderCacheInterface { /** * The cache contexts manager. * - * @var \Drupal\Core\Cache\CacheContextsManager + * @var \Drupal\Core\Cache\Context\CacheContextsManager */ protected $cacheContextsManager; @@ -45,7 +45,7 @@ class RenderCache implements RenderCacheInterface { * The request stack. * @param \Drupal\Core\Cache\CacheFactoryInterface $cache_factory * The cache factory. - * @param \Drupal\Core\Cache\CacheContextsManager $cache_contexts_manager + * @param \Drupal\Core\Cache\Context\CacheContextsManager $cache_contexts_manager * The cache contexts manager. */ public function __construct(RequestStack $request_stack, CacheFactoryInterface $cache_factory, CacheContextsManager $cache_contexts_manager) { diff --git a/core/modules/block/src/Tests/BlockViewBuilderTest.php b/core/modules/block/src/Tests/BlockViewBuilderTest.php index 02fec0f61622..7a7aa64d7f41 100644 --- a/core/modules/block/src/Tests/BlockViewBuilderTest.php +++ b/core/modules/block/src/Tests/BlockViewBuilderTest.php @@ -9,7 +9,7 @@ use Drupal\Component\Utility\Html; use Drupal\Core\Cache\Cache; -use Drupal\Core\Cache\UrlCacheContext; +use Drupal\Core\Cache\Context\UrlCacheContext; use Drupal\simpletest\KernelTestBase; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\RequestStack; diff --git a/core/modules/book/src/Cache/BookNavigationCacheContext.php b/core/modules/book/src/Cache/BookNavigationCacheContext.php index 531611f0ceb4..15ce15ad85a1 100644 --- a/core/modules/book/src/Cache/BookNavigationCacheContext.php +++ b/core/modules/book/src/Cache/BookNavigationCacheContext.php @@ -7,7 +7,7 @@ namespace Drupal\book\Cache; -use Drupal\Core\Cache\CacheContextInterface; +use Drupal\Core\Cache\Context\CacheContextInterface; use Symfony\Component\DependencyInjection\ContainerAware; use Symfony\Component\HttpFoundation\RequestStack; diff --git a/core/modules/language/tests/src/Unit/LanguageNegotiationUrlTest.php b/core/modules/language/tests/src/Unit/LanguageNegotiationUrlTest.php index df7554124c26..76d72b552147 100644 --- a/core/modules/language/tests/src/Unit/LanguageNegotiationUrlTest.php +++ b/core/modules/language/tests/src/Unit/LanguageNegotiationUrlTest.php @@ -57,7 +57,7 @@ protected function setUp() { $this->user = $this->getMockBuilder('Drupal\Core\Session\AccountInterface') ->getMock(); - $cache_contexts_manager = $this->getMockBuilder('Drupal\Core\Cache\CacheContextsManager') + $cache_contexts_manager = $this->getMockBuilder('Drupal\Core\Cache\Context\CacheContextsManager') ->disableOriginalConstructor() ->getMock(); $container = new ContainerBuilder(); diff --git a/core/modules/node/src/Cache/NodeAccessGrantsCacheContext.php b/core/modules/node/src/Cache/NodeAccessGrantsCacheContext.php index e89221217476..13ce366a0c9a 100644 --- a/core/modules/node/src/Cache/NodeAccessGrantsCacheContext.php +++ b/core/modules/node/src/Cache/NodeAccessGrantsCacheContext.php @@ -7,8 +7,8 @@ namespace Drupal\node\Cache; -use Drupal\Core\Cache\CalculatedCacheContextInterface; -use Drupal\Core\Cache\UserCacheContext; +use Drupal\Core\Cache\Context\CalculatedCacheContextInterface; +use Drupal\Core\Cache\Context\UserCacheContext; /** * Defines the node access view cache context service. diff --git a/core/modules/system/tests/modules/entity_test/src/Cache/EntityTestViewGrantsCacheContext.php b/core/modules/system/tests/modules/entity_test/src/Cache/EntityTestViewGrantsCacheContext.php index 53649f5f6c6b..1bc28f11c89a 100644 --- a/core/modules/system/tests/modules/entity_test/src/Cache/EntityTestViewGrantsCacheContext.php +++ b/core/modules/system/tests/modules/entity_test/src/Cache/EntityTestViewGrantsCacheContext.php @@ -7,7 +7,7 @@ namespace Drupal\entity_test\Cache; -use Drupal\Core\Cache\CacheContextInterface; +use Drupal\Core\Cache\Context\CacheContextInterface; /** * Defines the entity_test view grants cache context service. diff --git a/core/modules/system/tests/src/Unit/Menu/MenuLinkTreeTest.php b/core/modules/system/tests/src/Unit/Menu/MenuLinkTreeTest.php index d699a8e4e120..5e7f2a2faf66 100644 --- a/core/modules/system/tests/src/Unit/Menu/MenuLinkTreeTest.php +++ b/core/modules/system/tests/src/Unit/Menu/MenuLinkTreeTest.php @@ -44,7 +44,7 @@ protected function setUp() { $this->getMock('\Drupal\Core\Controller\ControllerResolverInterface') ); - $cache_contexts_manager = $this->getMockBuilder('Drupal\Core\Cache\CacheContextsManager') + $cache_contexts_manager = $this->getMockBuilder('Drupal\Core\Cache\Context\CacheContextsManager') ->disableOriginalConstructor() ->getMock(); $container = new ContainerBuilder(); diff --git a/core/modules/views/tests/modules/views_test_data/src/Cache/ViewsTestCacheContext.php b/core/modules/views/tests/modules/views_test_data/src/Cache/ViewsTestCacheContext.php index abc456bd46e4..b66ba3830a53 100644 --- a/core/modules/views/tests/modules/views_test_data/src/Cache/ViewsTestCacheContext.php +++ b/core/modules/views/tests/modules/views_test_data/src/Cache/ViewsTestCacheContext.php @@ -7,7 +7,7 @@ namespace Drupal\views_test_data\Cache; -use Drupal\Core\Cache\CacheContextInterface; +use Drupal\Core\Cache\Context\CacheContextInterface; /** * Test cache context which uses a dynamic context coming from state. diff --git a/core/tests/Drupal/Tests/Core/Cache/CacheableMetadataTest.php b/core/tests/Drupal/Tests/Core/Cache/CacheableMetadataTest.php index ccbb7d6b7f61..f2dbd3e28422 100644 --- a/core/tests/Drupal/Tests/Core/Cache/CacheableMetadataTest.php +++ b/core/tests/Drupal/Tests/Core/Cache/CacheableMetadataTest.php @@ -32,7 +32,7 @@ class CacheableMetadataTest extends UnitTestCase { * @see \Drupal\Tests\Core\Cache\CacheContextsTest */ public function testMerge(CacheableMetadata $a, CacheableMetadata $b, CacheableMetadata $expected) { - $cache_contexts_manager = $this->getMockBuilder('Drupal\Core\Cache\CacheContextsManager') + $cache_contexts_manager = $this->getMockBuilder('Drupal\Core\Cache\Context\CacheContextsManager') ->disableOriginalConstructor() ->getMock(); $container = new ContainerBuilder(); diff --git a/core/tests/Drupal/Tests/Core/Cache/CacheContextsManagerTest.php b/core/tests/Drupal/Tests/Core/Cache/Context/CacheContextsManagerTest.php similarity index 96% rename from core/tests/Drupal/Tests/Core/Cache/CacheContextsManagerTest.php rename to core/tests/Drupal/Tests/Core/Cache/Context/CacheContextsManagerTest.php index 859aee65693e..b4f5a2dfbcd3 100644 --- a/core/tests/Drupal/Tests/Core/Cache/CacheContextsManagerTest.php +++ b/core/tests/Drupal/Tests/Core/Cache/Context/CacheContextsManagerTest.php @@ -5,17 +5,17 @@ * Contains \Drupal\Tests\Core\Cache\CacheContextsTest. */ -namespace Drupal\Tests\Core\Cache; +namespace Drupal\Tests\Core\Cache\Context; -use Drupal\Core\Cache\CacheContextsManager; -use Drupal\Core\Cache\CacheContextInterface; -use Drupal\Core\Cache\CalculatedCacheContextInterface; +use Drupal\Core\Cache\Context\CacheContextsManager; +use Drupal\Core\Cache\Context\CacheContextInterface; +use Drupal\Core\Cache\Context\CalculatedCacheContextInterface; use Drupal\Core\DependencyInjection\ContainerBuilder; use Drupal\Tests\UnitTestCase; use Symfony\Component\DependencyInjection\Container; /** - * @coversDefaultClass \Drupal\Core\Cache\CacheContextsManager + * @coversDefaultClass \Drupal\Core\Cache\Context\CacheContextsManager * @group Cache */ class CacheContextsManagerTest extends UnitTestCase { diff --git a/core/tests/Drupal/Tests/Core/Render/BubbleableMetadataTest.php b/core/tests/Drupal/Tests/Core/Render/BubbleableMetadataTest.php index 51ff5062e8da..644df8aabf98 100644 --- a/core/tests/Drupal/Tests/Core/Render/BubbleableMetadataTest.php +++ b/core/tests/Drupal/Tests/Core/Render/BubbleableMetadataTest.php @@ -53,7 +53,7 @@ public function testMerge(BubbleableMetadata $a, CacheableMetadata $b, Bubbleabl ->getMock(); } - $cache_contexts_manager = $this->getMockBuilder('Drupal\Core\Cache\CacheContextsManager') + $cache_contexts_manager = $this->getMockBuilder('Drupal\Core\Cache\Context\CacheContextsManager') ->disableOriginalConstructor() ->getMock(); $container = new ContainerBuilder(); diff --git a/core/tests/Drupal/Tests/Core/Render/RendererTestBase.php b/core/tests/Drupal/Tests/Core/Render/RendererTestBase.php index 1ccdd2a35445..7388c6123b08 100644 --- a/core/tests/Drupal/Tests/Core/Render/RendererTestBase.php +++ b/core/tests/Drupal/Tests/Core/Render/RendererTestBase.php @@ -48,7 +48,7 @@ class RendererTestBase extends UnitTestCase { protected $cacheFactory; /** - * @var \Drupal\Core\Cache\CacheContextsManager|\PHPUnit_Framework_MockObject_MockObject + * @var \Drupal\Core\Cache\Context\CacheContextsManager|\PHPUnit_Framework_MockObject_MockObject */ protected $cacheContexts; @@ -101,7 +101,7 @@ protected function setUp() { $this->elementInfo = $this->getMock('Drupal\Core\Render\ElementInfoManagerInterface'); $this->requestStack = new RequestStack(); $this->cacheFactory = $this->getMock('Drupal\Core\Cache\CacheFactoryInterface'); - $this->cacheContextsManager = $this->getMockBuilder('Drupal\Core\Cache\CacheContextsManager') + $this->cacheContextsManager = $this->getMockBuilder('Drupal\Core\Cache\Context\CacheContextsManager') ->disableOriginalConstructor() ->getMock(); $this->cacheContextsManager->expects($this->any()) diff --git a/core/tests/Drupal/Tests/Core/Routing/UrlGeneratorTest.php b/core/tests/Drupal/Tests/Core/Routing/UrlGeneratorTest.php index 677d21461e43..f4e90de34db1 100644 --- a/core/tests/Drupal/Tests/Core/Routing/UrlGeneratorTest.php +++ b/core/tests/Drupal/Tests/Core/Routing/UrlGeneratorTest.php @@ -59,7 +59,7 @@ class UrlGeneratorTest extends UnitTestCase { * {@inheritdoc} */ protected function setUp() { - $cache_contexts_manager = $this->getMockBuilder('Drupal\Core\Cache\CacheContextsManager') + $cache_contexts_manager = $this->getMockBuilder('Drupal\Core\Cache\Context\CacheContextsManager') ->disableOriginalConstructor() ->getMock(); $container = new ContainerBuilder(); -- GitLab