Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Conditions.php
Go to the documentation of this file.
1 <?php
7 
11 
16 {
20  private $serializer;
21 
25  private $normalizer;
26 
31  public function __construct(
32  Json $serializer = null,
33  Normalizer $normalizer = null
34  ) {
35  $this->serializer = $serializer ?: ObjectManager::getInstance()->get(Json::class);
36  $this->normalizer = $normalizer ?: ObjectManager::getInstance()->get(Normalizer::class);
37  }
38 
45  public function encode(array $value)
46  {
47  return $this->normalizer->replaceReservedCharacters($this->serializer->serialize($value));
48  }
49 
56  public function decode($value)
57  {
58  return $this->serializer->unserialize(
59  $this->normalizer->restoreReservedCharacters($value)
60  );
61  }
62 }
$value
Definition: gender.phtml:16
__construct(Json $serializer=null, Normalizer $normalizer=null)
Definition: Conditions.php:31