ILIAS  trunk Revision v11.0_alpha-1713-gd8962da2f67
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
Internal.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
21 namespace ILIAS\LegalDocuments;
22 
23 use Closure;
25 
26 class Internal
27 {
29  private readonly array $map;
30 
36  public function __construct(Closure $create_provide, Closure $create_wiring, ?array $consumer_classes = null)
37  {
38  $lens = fn($consumer) => $consumer->uses($create_wiring($consumer->id()), new LazyProvide(fn() => $create_provide($consumer->id())));
39  $this->map = array_reduce(
40  $consumer_classes ?? require ConsumerObjective::PATH(),
41  fn($map, $consumer) => $map->append($lens(new $consumer())->map()),
42  new Map()
43  )->value();
44  }
45 
46  public function all(string $name): array
47  {
48  return $this->map[$name] ?? [];
49  }
50 
51  public function get(string $name, string $key)
52  {
53  return $this->map[$name][$key] ?? null;
54  }
55 }
__construct(Closure $create_provide, Closure $create_wiring, ?array $consumer_classes=null)
Definition: Internal.php:36
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null