Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AdminPathConfig.php
Go to the documentation of this file.
1 <?php
6 namespace Magento\Backend\Model;
7 
10 
17 {
21  protected $coreConfig;
22 
26  protected $backendConfig;
27 
31  protected $url;
32 
40  public function __construct(
41  \Magento\Framework\App\Config\ScopeConfigInterface $coreConfig,
42  \Magento\Backend\App\ConfigInterface $backendConfig,
43  \Magento\Framework\UrlInterface $url
44  ) {
45  $this->coreConfig = $coreConfig;
46  $this->backendConfig = $backendConfig;
47  $this->url = $url;
48  }
49 
57  {
58  return $this->url->getBaseUrl('link', true) . ltrim($request->getPathInfo(), '/');
59  }
60 
67  public function shouldBeSecure($path)
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  }
79 
85  public function getDefaultPath()
86  {
87  return $this->backendConfig->getValue('web/default/admin');
88  }
89 }
const XML_PATH_UNSECURE_BASE_URL
Definition: Store.php:66
getCurrentSecureUrl(\Magento\Framework\App\RequestInterface $request)
__construct(\Magento\Framework\App\Config\ScopeConfigInterface $coreConfig, \Magento\Backend\App\ConfigInterface $backendConfig, \Magento\Framework\UrlInterface $url)
const XML_PATH_SECURE_BASE_URL
Definition: Store.php:68
const XML_PATH_SECURE_IN_ADMINHTML
Definition: Store.php:72