|
5 | 5 | */
|
6 | 6 | namespace Magento\Framework\App\PageCache;
|
7 | 7 |
|
8 |
| -use Magento\Framework\App\ObjectManager; |
9 |
| -use Magento\Framework\Serialize\SerializerInterface; |
10 |
| -use Magento\Framework\App\Http\Context; |
11 |
| -use Magento\Framework\App\Http\ContextFactory; |
12 |
| -use Magento\Framework\App\Response\HttpFactory; |
13 |
| - |
14 | 8 | /**
|
15 | 9 | * Builtin cache processor
|
16 | 10 | */
|
@@ -39,50 +33,75 @@ class Kernel
|
39 | 33 | private $fullPageCache;
|
40 | 34 |
|
41 | 35 | /**
|
42 |
| - * @var SerializerInterface |
| 36 | + * @var \Magento\Framework\Serialize\SerializerInterface |
43 | 37 | */
|
44 | 38 | private $serializer;
|
45 | 39 |
|
46 | 40 | /**
|
47 |
| - * @var Context |
| 41 | + * @var \Magento\Framework\App\Http\Context |
48 | 42 | */
|
49 | 43 | private $context;
|
50 | 44 |
|
51 | 45 | /**
|
52 |
| - * @var ContextFactory |
| 46 | + * @var \Magento\Framework\App\Http\ContextFactory |
53 | 47 | */
|
54 | 48 | private $contextFactory;
|
55 | 49 |
|
56 | 50 | /**
|
57 |
| - * @var HttpFactory |
| 51 | + * @var \Magento\Framework\App\Response\HttpFactory |
58 | 52 | */
|
59 | 53 | private $httpFactory;
|
60 | 54 |
|
61 | 55 | /**
|
62 | 56 | * @param Cache $cache
|
63 | 57 | * @param Identifier $identifier
|
64 | 58 | * @param \Magento\Framework\App\Request\Http $request
|
65 |
| - * @param Context|null $context |
66 |
| - * @param ContextFactory|null $contextFactory |
67 |
| - * @param HttpFactory|null $httpFactory |
68 |
| - * @param SerializerInterface|null $serializer |
| 59 | + * @param \Magento\Framework\App\Http\Context|null $context |
| 60 | + * @param \Magento\Framework\App\Http\ContextFactory|null $contextFactory |
| 61 | + * @param \Magento\Framework\App\Response\HttpFactory|null $httpFactory |
| 62 | + * @param \Magento\Framework\Serialize\SerializerInterface|null $serializer |
69 | 63 | */
|
70 | 64 | public function __construct(
|
71 | 65 | \Magento\Framework\App\PageCache\Cache $cache,
|
72 | 66 | \Magento\Framework\App\PageCache\Identifier $identifier,
|
73 | 67 | \Magento\Framework\App\Request\Http $request,
|
74 |
| - Context $context = null, |
75 |
| - ContextFactory $contextFactory = null, |
76 |
| - HttpFactory $httpFactory = null, |
77 |
| - SerializerInterface $serializer = null |
| 68 | + \Magento\Framework\App\Http\Context $context = null, |
| 69 | + \Magento\Framework\App\Http\ContextFactory $contextFactory = null, |
| 70 | + \Magento\Framework\App\Response\HttpFactory $httpFactory = null, |
| 71 | + \Magento\Framework\Serialize\SerializerInterface $serializer = null |
78 | 72 | ) {
|
79 | 73 | $this->cache = $cache;
|
80 | 74 | $this->identifier = $identifier;
|
81 | 75 | $this->request = $request;
|
82 |
| - $this->context = $context ?: ObjectManager::getInstance()->get(Context::class); |
83 |
| - $this->contextFactory = $contextFactory ?: ObjectManager::getInstance()->get(ContextFactory::class); |
84 |
| - $this->httpFactory = $httpFactory ?: ObjectManager::getInstance()->get(HttpFactory::class); |
85 |
| - $this->serializer = $serializer ?: ObjectManager::getInstance()->get(SerializerInterface::class); |
| 76 | + |
| 77 | + if ($context) { |
| 78 | + $this->context = $context; |
| 79 | + } else { |
| 80 | + $this->context = \Magento\Framework\App\ObjectManager::getInstance()->get( |
| 81 | + \Magento\Framework\App\Http\Context::class |
| 82 | + ); |
| 83 | + } |
| 84 | + if ($contextFactory) { |
| 85 | + $this->contextFactory = $contextFactory; |
| 86 | + } else { |
| 87 | + $this->contextFactory = \Magento\Framework\App\ObjectManager::getInstance()->get( |
| 88 | + \Magento\Framework\App\Http\ContextFactory::class |
| 89 | + ); |
| 90 | + } |
| 91 | + if ($httpFactory) { |
| 92 | + $this->httpFactory = $httpFactory; |
| 93 | + } else { |
| 94 | + $this->httpFactory = \Magento\Framework\App\ObjectManager::getInstance()->get( |
| 95 | + \Magento\Framework\App\Response\HttpFactory::class |
| 96 | + ); |
| 97 | + } |
| 98 | + if ($serializer) { |
| 99 | + $this->serializer = $serializer; |
| 100 | + } else { |
| 101 | + $this->serializer = \Magento\Framework\App\ObjectManager::getInstance()->get( |
| 102 | + \Magento\Framework\Serialize\SerializerInterface::class |
| 103 | + ); |
| 104 | + } |
86 | 105 | }
|
87 | 106 |
|
88 | 107 | /**
|
@@ -190,7 +209,9 @@ private function buildResponse($responseData)
|
190 | 209 | private function getCache()
|
191 | 210 | {
|
192 | 211 | if (!$this->fullPageCache) {
|
193 |
| - $this->fullPageCache = ObjectManager::getInstance()->get(\Magento\PageCache\Model\Cache\Type::class); |
| 212 | + $this->fullPageCache = \Magento\Framework\App\ObjectManager::getInstance()->get( |
| 213 | + \Magento\PageCache\Model\Cache\Type::class |
| 214 | + ); |
194 | 215 | }
|
195 | 216 | return $this->fullPageCache;
|
196 | 217 | }
|
|
0 commit comments