Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions | Protected Attributes
AdminPathConfig Class Reference
Inheritance diagram for AdminPathConfig:
PathConfigInterface

Public Member Functions

 __construct (\Magento\Framework\App\Config\ScopeConfigInterface $coreConfig, \Magento\Backend\App\ConfigInterface $backendConfig, \Magento\Framework\UrlInterface $url)
 
 getCurrentSecureUrl (\Magento\Framework\App\RequestInterface $request)
 
 shouldBeSecure ($path)
 
 getDefaultPath ()
 

Protected Attributes

 $coreConfig
 
 $backendConfig
 
 $url
 

Detailed Description

Path config to be used in adminhtml area @api

Since
100.0.2

Definition at line 16 of file AdminPathConfig.php.

Constructor & Destructor Documentation

◆ __construct()

Constructor

Parameters
\Magento\Framework\App\Config\ScopeConfigInterface$coreConfig
\Magento\Backend\App\ConfigInterface$backendConfig
\Magento\Framework\UrlInterface$url

Definition at line 40 of file AdminPathConfig.php.

44  {
45  $this->coreConfig = $coreConfig;
46  $this->backendConfig = $backendConfig;
47  $this->url = $url;
48  }

Member Function Documentation

◆ getCurrentSecureUrl()

getCurrentSecureUrl ( \Magento\Framework\App\RequestInterface  $request)

{Retrieve secure url for current request

Parameters
\Magento\Framework\App\RequestInterface$request
Returns
string
}

Parameters
\Magento\Framework\App\RequestInterface$request
Returns
string

Implements PathConfigInterface.

Definition at line 56 of file AdminPathConfig.php.

57  {
58  return $this->url->getBaseUrl('link', true) . ltrim($request->getPathInfo(), '/');
59  }

◆ getDefaultPath()

getDefaultPath ( )

{Get router default request path

Returns
string
}

Returns
string

Implements PathConfigInterface.

Definition at line 85 of file AdminPathConfig.php.

86  {
87  return $this->backendConfig->getValue('web/default/admin');
88  }

◆ shouldBeSecure()

shouldBeSecure (   $path)

{Check whether given path should be secure according to configuration security requirements for URL "Secure" should not be confused with https protocol, it is about web/secure/*_url settings usage only

Parameters
string$path
Returns
bool
}

Parameters
string$path
Returns
bool

Implements PathConfigInterface.

Definition at line 67 of file AdminPathConfig.php.

68  {
69  return parse_url(
70  (string)$this->coreConfig->getValue(Store::XML_PATH_UNSECURE_BASE_URL, 'default'),
71  PHP_URL_SCHEME
72  ) === 'https'
73  || $this->backendConfig->isSetFlag(Store::XML_PATH_SECURE_IN_ADMINHTML)
74  && parse_url(
75  (string)$this->coreConfig->getValue(Store::XML_PATH_SECURE_BASE_URL, 'default'),
76  PHP_URL_SCHEME
77  ) === 'https';
78  }
const XML_PATH_UNSECURE_BASE_URL
Definition: Store.php:66
const XML_PATH_SECURE_BASE_URL
Definition: Store.php:68
const XML_PATH_SECURE_IN_ADMINHTML
Definition: Store.php:72

Field Documentation

◆ $backendConfig

$backendConfig
protected

Definition at line 26 of file AdminPathConfig.php.

◆ $coreConfig

$coreConfig
protected

Definition at line 21 of file AdminPathConfig.php.

◆ $url

$url
protected

Definition at line 31 of file AdminPathConfig.php.


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