Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
UrlCoder.php
Go to the documentation of this file.
1 <?php
8 
13 class UrlCoder
14 {
18  protected $_url;
19 
23  public function __construct(\Magento\Framework\UrlInterface $url)
24  {
25  $this->_url = $url;
26  }
27 
34  public function encode($url)
35  {
36  return strtr(base64_encode($url), '+/=', '-_,');
37  }
38 
45  public function decode($url)
46  {
47  return $this->_url->sessionUrlVar(base64_decode(strtr($url, '-_,', '+/=')));
48  }
49 }
__construct(\Magento\Framework\UrlInterface $url)
Definition: UrlCoder.php:23