ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilMailSearchLuceneResultParser.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
26 {
28  protected string $xml;
29 
30  public function __construct(ilMailSearchResult $result, string $xml)
31  {
32  $this->result = $result;
33  $this->xml = $xml;
34  }
35 
36  public function getXml(): string
37  {
38  return $this->xml;
39  }
40 
41  public function getResult(): ilMailSearchResult
42  {
43  return $this->result;
44  }
45 
46  public function parse(): void
47  {
48  if ($this->getXml() === '') {
49  return;
50  }
51 
52  $hits = new SimpleXMLElement($this->getXml());
53  foreach ($hits->children() as $user) {
54  foreach ($user->children() as $item) {
55  $fields = [];
56  foreach ($item->children() as $field) {
57  $name = (string) $field['name'];
58  $content = (string) $field;
59  $fields[] = [
60  $name, $content,
61  ];
62  }
63  $this->getResult()->addItem((int) $item['id'], $fields);
64  }
65  }
66  }
67 }
if($format !==null) $name
Definition: metadata.php:247
__construct(ilMailSearchResult $result, string $xml)