Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
EmulatedAdminhtmlAreaProcessor.php
Go to the documentation of this file.
1 <?php
7 
11 
17 {
23  private $scope;
24 
30  private $state;
31 
36  public function __construct(ScopeInterface $scope, State $state)
37  {
38  $this->scope = $scope;
39  $this->state = $state;
40  }
41 
53  public function process(callable $callback, array $params = [])
54  {
55  $currentScope = $this->scope->getCurrentScope();
56  try {
57  return $this->state->emulateAreaCode(Area::AREA_ADMINHTML, function () use ($callback, $params) {
58  $this->scope->setCurrentScope(Area::AREA_ADMINHTML);
59  return call_user_func_array($callback, $params);
60  });
61  } catch (\Exception $exception) {
62  throw $exception;
63  } finally {
64  $this->scope->setCurrentScope($currentScope);
65  }
66  }
67 }
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE]
Definition: website.php:18