Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Converter.php
Go to the documentation of this file.
1 <?php
9 
11 {
18  public function convert($source)
19  {
20  $output = [];
21  foreach ($source as $key => $value) {
22  $this->_setArrayValue($output, $key, $value);
23  }
24  return $output;
25  }
26 
35  protected function _setArrayValue(array &$container, $path, $value)
36  {
37  $segments = explode('/', $path);
38  $currentPointer = & $container;
39  foreach ($segments as $segment) {
40  if (!isset($currentPointer[$segment])) {
41  $currentPointer[$segment] = [];
42  }
43  $currentPointer = & $currentPointer[$segment];
44  }
45  $currentPointer = $value;
46  }
47 }
$source
Definition: source.php:23
$value
Definition: gender.phtml:16
_setArrayValue(array &$container, $path, $value)
Definition: Converter.php:35