Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
IdentityService.php
Go to the documentation of this file.
1 <?php
7 
8 use Ramsey\Uuid\Uuid;
9 
14 {
18  private $uuidFactory;
19 
23  public function __construct()
24  {
25  $this->uuidFactory = new \Ramsey\Uuid\UuidFactory();
26  }
27 
31  public function generateId()
32  {
33  $uuid = $this->uuidFactory->uuid4();
34  return $uuid->toString();
35  }
36 
40  public function generateIdForData($data)
41  {
42  $uuid = $this->uuidFactory->uuid3(Uuid::NAMESPACE_DNS, $data);
43  return $uuid->toString();
44  }
45 }