|
6 | 6 | namespace Magento\Framework\App\PageCache;
|
7 | 7 |
|
8 | 8 | use Magento\Framework\App\State as AppState;
|
| 9 | +use Magento\Framework\App\ObjectManager; |
9 | 10 |
|
10 | 11 | /**
|
11 | 12 | * Builtin cache processor
|
@@ -82,43 +83,17 @@ public function __construct(
|
82 | 83 | $this->cache = $cache;
|
83 | 84 | $this->identifier = $identifier;
|
84 | 85 | $this->request = $request;
|
85 |
| - |
86 |
| - if ($context) { |
87 |
| - $this->context = $context; |
88 |
| - } else { |
89 |
| - $this->context = \Magento\Framework\App\ObjectManager::getInstance()->get( |
90 |
| - \Magento\Framework\App\Http\Context::class |
91 |
| - ); |
92 |
| - } |
93 |
| - if ($contextFactory) { |
94 |
| - $this->contextFactory = $contextFactory; |
95 |
| - } else { |
96 |
| - $this->contextFactory = \Magento\Framework\App\ObjectManager::getInstance()->get( |
97 |
| - \Magento\Framework\App\Http\ContextFactory::class |
98 |
| - ); |
99 |
| - } |
100 |
| - if ($httpFactory) { |
101 |
| - $this->httpFactory = $httpFactory; |
102 |
| - } else { |
103 |
| - $this->httpFactory = \Magento\Framework\App\ObjectManager::getInstance()->get( |
104 |
| - \Magento\Framework\App\Response\HttpFactory::class |
105 |
| - ); |
106 |
| - } |
107 |
| - if ($serializer) { |
108 |
| - $this->serializer = $serializer; |
109 |
| - } else { |
110 |
| - $this->serializer = \Magento\Framework\App\ObjectManager::getInstance()->get( |
111 |
| - \Magento\Framework\Serialize\SerializerInterface::class |
112 |
| - ); |
113 |
| - } |
114 |
| - |
115 |
| - if ($state) { |
116 |
| - $this->state = $state; |
117 |
| - } else { |
118 |
| - $this->state = \Magento\Framework\App\ObjectManager::getInstance()->get( |
119 |
| - AppState::class |
120 |
| - ); |
121 |
| - } |
| 86 | + $this->context = $context ?? ObjectManager::getInstance()->get(\Magento\Framework\App\Http\Context::class); |
| 87 | + $this->contextFactory = $contextFactory ?? ObjectManager::getInstance()->get( |
| 88 | + \Magento\Framework\App\Http\ContextFactory::class |
| 89 | + ); |
| 90 | + $this->httpFactory = $httpFactory ?? ObjectManager::getInstance()->get( |
| 91 | + \Magento\Framework\App\Response\HttpFactory::class |
| 92 | + ); |
| 93 | + $this->serializer = $serializer ?? ObjectManager::getInstance()->get( |
| 94 | + \Magento\Framework\Serialize\SerializerInterface::class |
| 95 | + ); |
| 96 | + $this->state = $state ?? ObjectManager::getInstance()->get(AppState::class); |
122 | 97 | }
|
123 | 98 |
|
124 | 99 | /**
|
@@ -231,7 +206,7 @@ private function buildResponse($responseData)
|
231 | 206 | private function getCache()
|
232 | 207 | {
|
233 | 208 | if (!$this->fullPageCache) {
|
234 |
| - $this->fullPageCache = \Magento\Framework\App\ObjectManager::getInstance()->get( |
| 209 | + $this->fullPageCache = $objectManager->get( |
235 | 210 | \Magento\PageCache\Model\Cache\Type::class
|
236 | 211 | );
|
237 | 212 | }
|
|
0 commit comments