Magento Extensions Rating 2024
EXTENSIONS BY CATEGORY
B2B (Business-To-Business)
Blog
Customer
ERP (Enterprise Resource Planning)
Mega Menu
One Step Checkout
Order
POS (Point Of Sale)
Search
Shopping Cart
Sitemap
SEO
Social
Stock & Inventory Management
EXTENSIONS BY DEVELOPER
aheadWorks
Amasty
Boost My Shop
BSS Commerce
Magestore
MageWorx
Mirasvit
Templates Master
Wyomind
XTENTO
Magento 2 Documentation
Magento 2 Documentation
2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
vendor
magento
module-store
Model
ScopeValidator.php
Go to the documentation of this file.
1
<?php
6
namespace
Magento\Store\Model
;
7
8
use
Magento\Framework\App\ScopeValidatorInterface
;
9
use
Magento\Framework\App\Config\ScopeConfigInterface
;
10
use
Magento\Framework\Exception\NoSuchEntityException
;
11
use
Magento\Framework\App\ScopeResolverPool
;
12
13
class
ScopeValidator
implements
ScopeValidatorInterface
14
{
18
protected
$scopeResolverPool
;
19
23
public
function
__construct
(
ScopeResolverPool
$scopeResolverPool
)
24
{
25
$this->scopeResolverPool =
$scopeResolverPool
;
26
}
27
31
public
function
isValidScope
($scope, $scopeId =
null
)
32
{
33
if
($scope ==
ScopeConfigInterface::SCOPE_TYPE_DEFAULT
&& !$scopeId) {
34
return
true
;
35
}
36
37
try
{
38
$scopeResolver = $this->scopeResolverPool->get($scope);
39
if
(!$scopeResolver->getScope($scopeId)->getId()) {
40
return
false
;
41
}
42
}
catch
(\InvalidArgumentException $e) {
43
return
false
;
44
}
catch
(
NoSuchEntityException
$e) {
45
return
false
;
46
}
47
48
return
true
;
49
}
50
}
Magento\Store\Model\ScopeValidator\__construct
__construct(ScopeResolverPool $scopeResolverPool)
Definition:
ScopeValidator.php:23
Magento\Store\Model\ScopeValidator\$scopeResolverPool
$scopeResolverPool
Definition:
ScopeValidator.php:18
Magento\Framework\App\Config\ScopeConfigInterface\SCOPE_TYPE_DEFAULT
const SCOPE_TYPE_DEFAULT
Definition:
ScopeConfigInterface.php:20
Magento\Store\Model\ScopeValidator
Definition:
ScopeValidator.php:13
Magento\Store\Model
Magento\Store\Model\ScopeValidator\isValidScope
isValidScope($scope, $scopeId=null)
Definition:
ScopeValidator.php:31
Magento\Framework\App\ScopeValidatorInterface
Definition:
ScopeValidatorInterface.php:12
Magento\Framework\App\Config\ScopeConfigInterface
Definition:
ScopeConfigInterface.php:15
Magento\Framework\App\ScopeResolverPool
Definition:
ScopeResolverPool.php:12
Magento\Framework\Exception\NoSuchEntityException
Definition:
NoSuchEntityException.php:16