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 
9 
10 class Converter implements ConverterInterface
11 {
15  public function convert($source)
16  {
17  $stemmer = $source->getElementsByTagName('stemmer');
18  $stemmerInfo = [];
19  foreach ($stemmer as $stemmerItem) {
20  foreach ($stemmerItem->childNodes as $childNode) {
21  if ($childNode->nodeType === XML_ELEMENT_NODE) {
22  $stemmerInfo[$childNode->localName]= $childNode->textContent;
23  }
24  }
25  }
26 
27  $stopwords = $source->getElementsByTagName('stopwords_file');
28  $stopwordsInfo = [];
29  foreach ($stopwords as $stopwordsItem) {
30  foreach ($stopwordsItem->childNodes as $childNode) {
31  if ($childNode->nodeType === XML_ELEMENT_NODE) {
32  $stopwordsInfo[$childNode->localName]= $childNode->textContent;
33  }
34  }
35  }
36 
37  return ['stemmerInfo' => $stemmerInfo, 'stopwordsInfo' => $stopwordsInfo];
38  }
39 }
$source
Definition: source.php:23