Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
ScopeResolver.php
Go to the documentation of this file.
1 <?php
7 namespace Magento\Framework\Url;
8 
14 class ScopeResolver implements \Magento\Framework\Url\ScopeResolverInterface
15 {
19  protected $scopeResolver;
20 
24  protected $areaCode;
25 
31  {
32  $this->scopeResolver = $scopeResolver;
33  $this->areaCode = $areaCode;
34  }
35 
39  public function getScope($scopeId = null)
40  {
41  $scope = $this->scopeResolver->getScope($scopeId);
42  if (!$scope instanceof \Magento\Framework\Url\ScopeInterface) {
43  throw new \Magento\Framework\Exception\LocalizedException(
44  new \Magento\Framework\Phrase('The scope object is invalid. Verify the scope object and try again.')
45  );
46  }
47 
48  return $scope;
49  }
50 
56  public function getScopes()
57  {
58  return $this->scopeResolver->getScopes();
59  }
60 
64  public function getAreaCode()
65  {
66  return $this->areaCode;
67  }
68 }
__construct(\Magento\Framework\App\ScopeResolverInterface $scopeResolver, $areaCode=null)