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

Public Member Functions

 __construct (ObjectManagerInterface $objectManager)
 
 getScope ($scopeId=null)
 
 getScopes ()
 

Protected Attributes

 $objectManager
 

Detailed Description

Definition at line 10 of file ScopeResolver.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( ObjectManagerInterface  $objectManager)

ScopeResolver constructor

Parameters
ObjectManagerInterface$objectManager

Definition at line 27 of file ScopeResolver.php.

28  {
29  $this->objectManager = $objectManager;
30  }

Member Function Documentation

◆ getScope()

getScope (   $scopeId = null)

{Retrieve application scope object

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

Returns
ScopeDefault

Implements ScopeResolverInterface.

Definition at line 36 of file ScopeResolver.php.

37  {
38  if (!$this->defaultScope) {
39  $this->defaultScope = $this->objectManager->create(ScopeDefault::class);
40  }
41 
42  return $this->defaultScope;
43  }

◆ getScopes()

getScopes ( )

Retrieve a list of available scopes

Returns
ScopeInterface[]

Implements ScopeResolverInterface.

Definition at line 50 of file ScopeResolver.php.

51  {
52  return [$this->defaultScope];
53  }

Field Documentation

◆ $objectManager

$objectManager
protected

Definition at line 15 of file ScopeResolver.php.


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