Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Identifier.php
Go to the documentation of this file.
1 <?php
7 
10 
15 {
19  protected $request;
20 
24  protected $context;
25 
29  private $serializer;
30 
36  public function __construct(
37  \Magento\Framework\App\Request\Http $request,
38  \Magento\Framework\App\Http\Context $context,
39  Json $serializer = null
40  ) {
41  $this->request = $request;
42  $this->context = $context;
43  $this->serializer = $serializer ?: ObjectManager::getInstance()->get(Json::class);
44  }
45 
51  public function getValue()
52  {
53  $data = [
54  $this->request->isSecure(),
55  $this->request->getUriString(),
56  $this->request->get(\Magento\Framework\App\Response\Http::COOKIE_VARY_STRING)
57  ?: $this->context->getVaryString()
58  ];
59  return sha1($this->serializer->serialize($data));
60  }
61 }
__construct(\Magento\Framework\App\Request\Http $request, \Magento\Framework\App\Http\Context $context, Json $serializer=null)
Definition: Identifier.php:36