Skip to content

Commit

Permalink
Magento 2.1.x portability
Browse files Browse the repository at this point in the history
  • Loading branch information
thomas-kl1 committed Jun 29, 2018
1 parent dcbe334 commit ab77f6a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
14 changes: 7 additions & 7 deletions Block/Messages/PrivacyMessagePopup.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
namespace Opengento\Gdpr\Block\Messages;

use Magento\Cms\Helper\Page as HelperPage;
use Magento\Framework\Serialize\Serializer\Json;
use Magento\Framework\Json\Encoder;
use Magento\Framework\View\Element\Template;
use Magento\Framework\View\Element\Template\Context;
use Opengento\Gdpr\Model\Config;
Expand All @@ -31,9 +31,9 @@ class PrivacyMessagePopup extends Template
private $helperPage;

/**
* @var \Magento\Framework\Serialize\Serializer\Json
* @var \Magento\Framework\Json\Encoder
*/
private $jsonSerializer;
private $jsonEncoder;

/**
* @var string
Expand All @@ -44,19 +44,19 @@ class PrivacyMessagePopup extends Template
* @param \Magento\Framework\View\Element\Template\Context $context
* @param \Opengento\Gdpr\Model\Config $config
* @param \Magento\Cms\Helper\Page $helperPage
* @param \Magento\Framework\Serialize\Serializer\Json $jsonSerializer
* @param \Magento\Framework\Json\Encoder $jsonEncoder
* @param array $data
*/
public function __construct(
Context $context,
Config $config,
HelperPage $helperPage,
Json $jsonSerializer,
Encoder $jsonEncoder,
array $data = []
) {
$this->config = $config;
$this->helperPage = $helperPage;
$this->jsonSerializer = $jsonSerializer;
$this->jsonEncoder = $jsonEncoder;
parent::__construct($context, $data);
}

Expand All @@ -71,7 +71,7 @@ public function getJsLayout()
'notificationText' => $this->config->getCookieDisclosureInformationBlockId()
];

return $this->jsonSerializer->serialize($this->jsLayout);
return $this->jsonEncoder->encode($this->jsLayout);
}

/**
Expand Down
14 changes: 7 additions & 7 deletions Service/Export/Renderer/JsonRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
namespace Opengento\Gdpr\Service\Export\Renderer;

use Magento\Framework\Filesystem;
use Magento\Framework\Serialize\Serializer\Json;
use Magento\Framework\Json\Encoder;
use Opengento\Gdpr\Service\Export\AbstractRenderer;
use Opengento\Gdpr\Service\Export\RendererInterface;

Expand All @@ -18,19 +18,19 @@
class JsonRenderer extends AbstractRenderer implements RendererInterface
{
/**
* @var \Magento\Framework\Serialize\Serializer\Json
* @var \Magento\Framework\Json\Encoder
*/
private $jsonSerializer;
private $jsonEncoder;

/**
* @param \Magento\Framework\Filesystem $filesystem
* @param \Magento\Framework\Serialize\Serializer\Json $jsonSerializer
* @param \Magento\Framework\Json\Encoder $jsonEncoder
*/
public function __construct(
Filesystem $filesystem,
Json $jsonSerializer
Encoder $jsonEncoder
) {
$this->jsonSerializer = $jsonSerializer;
$this->jsonEncoder = $jsonEncoder;
parent::__construct($filesystem);
}

Expand All @@ -39,6 +39,6 @@ public function __construct(
*/
public function render(array $data): string
{
return $this->jsonSerializer->serialize($data);
return $this->jsonEncoder->encode($data);
}
}
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"rgpd"
],
"require": {
"magento/framework": ">=100.2.0",
"magento/framework": "~100.0.2|~100.1.0",
"magento/module-backend": ">=100.0.0",
"magento/module-config": ">=100.0.2",
"magento/module-customer": ">=100.0.2",
Expand Down

0 comments on commit ab77f6a

Please sign in to comment.