Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
SecurityInfo.php
Go to the documentation of this file.
1 <?php
8 namespace Magento\Framework\Url;
9 
10 class SecurityInfo implements \Magento\Framework\Url\SecurityInfoInterface
11 {
17  protected $secureUrlsList = [];
18 
22  protected $excludedUrlsList = [];
23 
29  protected $secureUrlsCache = [];
30 
35  public function __construct($secureUrlList = [], $excludedUrlList = [])
36  {
37  $this->secureUrlsList = $secureUrlList;
38  $this->excludedUrlsList = $excludedUrlList;
39  }
40 
47  public function isSecure($url)
48  {
49  if (!isset($this->secureUrlsCache[$url])) {
50  $this->secureUrlsCache[$url] = false;
51  foreach ($this->excludedUrlsList as $match) {
52  if (strpos($url, (string)$match) === 0) {
53  return $this->secureUrlsCache[$url];
54  }
55  }
56  foreach ($this->secureUrlsList as $match) {
57  if (strpos($url, (string)$match) === 0) {
58  $this->secureUrlsCache[$url] = true;
59  break;
60  }
61  }
62  }
63  return $this->secureUrlsCache[$url];
64  }
65 }
__construct($secureUrlList=[], $excludedUrlList=[])