Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions | Protected Attributes
UrlCoder Class Reference

Public Member Functions

 __construct (\Magento\Framework\UrlInterface $url)
 
 encode ($url)
 
 decode ($url)
 

Protected Attributes

 $_url
 

Detailed Description

@api

Since
100.0.2

Definition at line 13 of file UrlCoder.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( \Magento\Framework\UrlInterface  $url)
Parameters
\Magento\Framework\UrlInterface$url

Definition at line 23 of file UrlCoder.php.

24  {
25  $this->_url = $url;
26  }

Member Function Documentation

◆ decode()

decode (   $url)

base64_decode() for URLs decoding

Parameters
string$url
Returns
string

Definition at line 45 of file UrlCoder.php.

46  {
47  return $this->_url->sessionUrlVar(base64_decode(strtr($url, '-_,', '+/=')));
48  }

◆ encode()

encode (   $url)

base64_encode() for URLs encoding

Parameters
string$url
Returns
string

Definition at line 34 of file UrlCoder.php.

35  {
36  return strtr(base64_encode($url), '+/=', '-_,');
37  }

Field Documentation

◆ $_url

$_url
protected

Definition at line 18 of file UrlCoder.php.


The documentation for this class was generated from the following file: