Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions | Protected Attributes
ScopeResolver Class Reference
Inheritance diagram for ScopeResolver:
ScopeResolverInterface ScopeResolverInterface ScopeResolver

Public Member Functions

 __construct (\Magento\Framework\App\ScopeResolverInterface $scopeResolver, $areaCode=null)
 
 getScope ($scopeId=null)
 
 getScopes ()
 
 getAreaCode ()
 

Protected Attributes

 $scopeResolver
 
 $areaCode
 

Detailed Description

Class ScopeResolver

URL scope resolver.

Definition at line 14 of file ScopeResolver.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( \Magento\Framework\App\ScopeResolverInterface  $scopeResolver,
  $areaCode = null 
)
Parameters
\Magento\Framework\App\ScopeResolverInterface$scopeResolver
string | null$areaCode

Definition at line 30 of file ScopeResolver.php.

31  {
32  $this->scopeResolver = $scopeResolver;
33  $this->areaCode = $areaCode;
34  }

Member Function Documentation

◆ getAreaCode()

getAreaCode ( )

{Retrieve area code

Returns
string|null
}

Implements ScopeResolverInterface.

Definition at line 64 of file ScopeResolver.php.

◆ getScope()

getScope (   $scopeId = null)

{Retrieve application scope object

Parameters
null | int$scopeId
Returns
\Magento\Framework\App\ScopeInterface
}

Implements ScopeResolverInterface.

Definition at line 39 of file ScopeResolver.php.

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  }

◆ getScopes()

getScopes ( )

Retrieve array of URL scopes.

Returns
\Magento\Framework\Url\ScopeInterface[]

Implements ScopeResolverInterface.

Definition at line 56 of file ScopeResolver.php.

57  {
58  return $this->scopeResolver->getScopes();
59  }

Field Documentation

◆ $areaCode

$areaCode
protected

Definition at line 24 of file ScopeResolver.php.

◆ $scopeResolver

$scopeResolver
protected

Definition at line 19 of file ScopeResolver.php.


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