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

Public Member Functions

 __construct (\Magento\Framework\App\AreaList $areaList, $defaultScope='primary')
 
 getCurrentScope ()
 
 setCurrentScope ($scope)
 
 getAllScopes ()
 

Protected Attributes

 $_defaultScope
 
 $_currentScope
 
 $_areaList
 

Detailed Description

Definition at line 8 of file Scope.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( \Magento\Framework\App\AreaList  $areaList,
  $defaultScope = 'primary' 
)

Constructor

Parameters
\Magento\Framework\App\AreaList$areaList
string$defaultScope

Definition at line 37 of file Scope.php.

38  {
39  $this->_defaultScope = $this->_currentScope = $defaultScope;
40  $this->_areaList = $areaList;
41  }

Member Function Documentation

◆ getAllScopes()

getAllScopes ( )

Retrieve list of available config scopes

Returns
string[]

Implements ScopeListInterface.

Definition at line 69 of file Scope.php.

70  {
71  $codes = $this->_areaList->getCodes();
72  array_unshift($codes, $this->_defaultScope);
73  return $codes;
74  }

◆ getCurrentScope()

getCurrentScope ( )

Get current configuration scope identifier

Returns
string

Implements ScopeInterface.

Definition at line 48 of file Scope.php.

49  {
50  return $this->_currentScope;
51  }

◆ setCurrentScope()

setCurrentScope (   $scope)

Set current configuration scope

Parameters
string$scope
Returns
void

Implements ScopeInterface.

Definition at line 59 of file Scope.php.

60  {
61  $this->_currentScope = $scope;
62  }

Field Documentation

◆ $_areaList

$_areaList
protected

Definition at line 29 of file Scope.php.

◆ $_currentScope

$_currentScope
protected

Definition at line 22 of file Scope.php.

◆ $_defaultScope

$_defaultScope
protected

Definition at line 15 of file Scope.php.


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