ILIAS  trunk Revision v11.0_alpha-1843-g9e1fad99175
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
class.ilBiblRisFileReader.php
Go to the documentation of this file.
1 <?php
2 
25 {
27 
28  public function __construct(
29  ilBiblEntryFactoryInterface $entry_factory,
30  ilBiblFieldFactoryInterface $field_factory,
31  ilBiblAttributeFactoryInterface $attribute_factory
32  ) {
33  parent::__construct($entry_factory, $field_factory, $attribute_factory);
34  $this->wrapper = new ilBiblRisFileReaderWrapper();
35  }
36 
37  public function parseContent(): array
38  {
39  $content = $this->wrapper->parseContent($this->file_content);
40 
41  return $this->flattenContent($content);
42  }
43 
44  private function flattenContent(array $content): array
45  {
46  $flattener = function ($i) {
47  if (is_array($i)) {
48  return implode(", ", $i);
49  }
50  return $i;
51  };
52 
53  $walker = function ($item) use ($flattener) {
54  if (is_array($item)) {
55  foreach ($item as $k => $i) {
56  $item[$k] = $flattener($i);
57  }
58  return $item;
59  }
60  return $item;
61  };
62 
63  return array_map($walker, $content);
64  }
65 }
Interface ilBiblFileReaderInterface.
Class ilBiblFileReaderBase.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Interface ilBiblEntryFactoryInterface.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ilBiblRisFileReaderWrapper $wrapper
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(Container $dic, ilPlugin $plugin)
__construct(ilBiblEntryFactoryInterface $entry_factory, ilBiblFieldFactoryInterface $field_factory, ilBiblAttributeFactoryInterface $attribute_factory)