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

Public Member Functions

 __construct (\Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Framework\Url\SecurityInfoInterface $urlSecurityInfo, StoreManagerInterface $storeManager)
 
 getCurrentSecureUrl (\Magento\Framework\App\RequestInterface $request)
 
 shouldBeSecure ($path)
 
 getDefaultPath ()
 
- Public Member Functions inherited from PathConfigInterface
 getCurrentSecureUrl (\Magento\Framework\App\RequestInterface $request)
 

Detailed Description

Definition at line 8 of file PathConfig.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( \Magento\Framework\App\Config\ScopeConfigInterface  $scopeConfig,
\Magento\Framework\Url\SecurityInfoInterface  $urlSecurityInfo,
StoreManagerInterface  $storeManager 
)
Parameters
\Magento\Framework\App\Config\ScopeConfigInterface$scopeConfig
\Magento\Framework\Url\SecurityInfoInterface$urlSecurityInfo
StoreManagerInterface$storeManager

Definition at line 30 of file PathConfig.php.

34  {
35  $this->scopeConfig = $scopeConfig;
36  $this->urlSecurityInfo = $urlSecurityInfo;
37  $this->storeManager = $storeManager;
38  }

Member Function Documentation

◆ getCurrentSecureUrl()

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

{}

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

Definition at line 46 of file PathConfig.php.

47  {
48  $alias = $request->getAlias(\Magento\Framework\Url::REWRITE_REQUEST_PATH_ALIAS) ?: $request->getPathInfo();
49  return $this->storeManager->getStore()->getBaseUrl('link', true) . ltrim($alias, '/');
50  }
if(!trim($html)) $alias
Definition: details.phtml:20

◆ getDefaultPath()

getDefaultPath ( )

{Get router default request path

Returns
string
}

Returns
string

Implements PathConfigInterface.

Definition at line 84 of file PathConfig.php.

85  {
86  $store = $this->storeManager->getStore();
87  $value = $this->scopeConfig->getValue('web/default/front', ScopeInterface::SCOPE_STORE, $store);
88  return $value;
89  }
$value
Definition: gender.phtml:16

◆ 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 58 of file PathConfig.php.

59  {
60  return parse_url(
61  $this->scopeConfig->getValue(
64  ),
65  PHP_URL_SCHEME
66  ) === 'https'
67  || $this->scopeConfig->isSetFlag(
70  ) && parse_url(
71  $this->scopeConfig->getValue(
74  ),
75  PHP_URL_SCHEME
76  ) == 'https' && $this->urlSecurityInfo->isSecure($path);
77  }
const XML_PATH_UNSECURE_BASE_URL
Definition: Store.php:66
const XML_PATH_SECURE_IN_FRONTEND
Definition: Store.php:70
const XML_PATH_SECURE_BASE_URL
Definition: Store.php:68

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