ILIAS  trunk Revision v12.0_alpha-16-g3e876e53c80
PropertiesAggregatorImpl.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
26use Generator;
27
29{
30 public function __construct(
31 protected Container $dic,
32 protected PropertiesFactory $factory,
33 ) {
34 }
35
39 protected array $readers_by_type = [];
40
44 public function getSubitemProperties(
45 int $parent_ref_id,
46 string $parent_type,
47 ID ...$subitem_ids
48 ): Generator {
49 if ($subitem_ids === []) {
50 yield from [];
51 }
52 yield from $this->getReader($parent_type)?->getSubitemProperties(
53 $this->factory,
54 $parent_ref_id,
55 ...$subitem_ids
56 ) ?? [];
57 }
58
59 protected function getReader(string $parent_type): ?PropertiesReader
60 {
61 if (isset($this->readers_by_type[$parent_type])) {
62 return $this->readers_by_type[$parent_type];
63 }
64
65 $class_name = (include BuildSubitemPresentationReadersObjective::PATH())[$parent_type] ?? null;
66 if ($class_name === null || !class_exists((string) $class_name)) {
67 return null;
68 }
69 $reader = new $class_name();
70 if (!$reader instanceof PropertiesReader) {
71 return null;
72 }
73 $reader->init($this->dic);
74 return $this->readers_by_type[$parent_type] = $reader;
75 }
76}
factory()
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:36
The scope of this class is split ilias-conform URI's into components.
Definition: URI.php:35
getSubitemProperties(int $parent_ref_id, string $parent_type, ID ... $subitem_ids)
__construct(protected Container $dic, protected PropertiesFactory $factory,)
$dic
Definition: ltiresult.php:33
if(!file_exists('../ilias.ini.php'))