Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
NamedParams.php
Go to the documentation of this file.
1 <?php
7 
9 
14 {
20  private $paramInterpreter;
21 
25  public function __construct(InterpreterInterface $paramInterpreter)
26  {
27  $this->paramInterpreter = $paramInterpreter;
28  }
29 
35  public function evaluate(array $data)
36  {
37  $params = isset($data['param']) ? $data['param'] : [];
38  if (!is_array($params)) {
39  throw new \InvalidArgumentException('Layout argument parameters are expected to be an array.');
40  }
41  $result = [];
42  foreach ($params as $paramKey => $paramData) {
43  if (!is_array($paramData)) {
44  throw new \InvalidArgumentException('Parameter data of layout argument is expected to be an array.');
45  }
46  $result[$paramKey] = $this->paramInterpreter->evaluate($paramData);
47  }
48  return $result;
49  }
50 }
__construct(InterpreterInterface $paramInterpreter)
Definition: NamedParams.php:25
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE]
Definition: website.php:18