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
7 
14 {
18  const API_RESOURCES = 'resource';
19 
20  const API_RESOURCE_NAME = 'name';
21 
27  public function convert($source)
28  {
29  $result = [];
31  $integrations = $source->getElementsByTagName('integration');
33  foreach ($integrations as $integration) {
34  if ($integration->nodeType != XML_ELEMENT_NODE) {
35  continue;
36  }
37  $integrationName = $integration->attributes->getNamedItem('name')->nodeValue;
38  $result[$integrationName] = [];
39  $result[$integrationName][self::API_RESOURCES] = [];
41  $resources = $integration->getElementsByTagName('resource');
43  foreach ($resources as $resource) {
44  if ($resource->nodeType != XML_ELEMENT_NODE) {
45  continue;
46  }
47  $resource = $resource->attributes->getNamedItem('name')->nodeValue;
48  $result[$integrationName][self::API_RESOURCES][] = $resource;
49  }
50  }
51  return $result;
52  }
53 }
$source
Definition: source.php:23
$resource
Definition: bulk.php:12