ILIAS  trunk Revision v11.0_alpha-1723-g8e69f309bab
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
EmptyDependencyMap.php
Go to the documentation of this file.
1 <?php
2 
20 
23 
30 {
31  protected array $maps = [];
32 
36  public function getDependencyWith(Container $DIC, string $fullyQualifiedDomainName, string $for, callable $map)
37  {
38  $result = $map($DIC, $fullyQualifiedDomainName, $for);
39  if ($result) {
40  return $result;
41  }
42  return $this->getDependency($DIC, $fullyQualifiedDomainName, $for);
43  }
44 
50  public function with(callable $map): DependencyMap
51  {
52  $dependency_map = new static();
53  $dependency_map->maps = array_merge([$map], $this->maps);
54 
55  return $dependency_map;
56  }
57 
61  public function getDependency(Container $DIC, string $fullyQualifiedDomainName, string $for)
62  {
63  foreach ($this->maps as $map) {
64  $result = $map($DIC, $fullyQualifiedDomainName, $for);
65  if ($result) {
66  return $result;
67  }
68  }
69 
70  throw new NoSuchServiceException("The requested service " . $fullyQualifiedDomainName
71  . " could not be resolved.");
72  }
73 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:35
getDependencyWith(Container $DIC, string $fullyQualifiedDomainName, string $for, callable $map)
The DIC to take the dependencies from. What domain name is requested? (DIC $DIC, string $fullyQualifi...
with(callable $map)
Returns a new dependency map with the given mapping.
getDependency(Container $DIC, string $fullyQualifiedDomainName, string $for)
The DIC to take the dependencies from. What domain name is requested? What class is the dependency fo...
global $DIC
Definition: shib_login.php:22