ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
EmptyDependencyMap.php
Go to the documentation of this file.
1 <?php
2 
4 
7 
16 {
17 
21  protected $maps = [];
22 
23 
27  public function getDependencyWith(Container $DIC, $fullyQualifiedDomainName, $for, callable $map)
28  {
29  $result = $map($DIC, $fullyQualifiedDomainName, $for);
30  if ($result) {
31  return $result;
32  } else {
33  return $this->getDependency($DIC, $fullyQualifiedDomainName, $for);
34  }
35  }
36 
37 
46  public function with(callable $map)
47  {
48  $dependencyMap = new static();
49  $dependencyMap->maps = array_merge([$map], $this->maps);
50 
51  return $dependencyMap;
52  }
53 
54 
58  public function getDependency(Container $DIC, $fullyQualifiedDomainName, $for)
59  {
60  foreach ($this->maps as $map) {
61  $result = $map($DIC, $fullyQualifiedDomainName, $for);
62  if ($result) {
63  return $result;
64  }
65  }
66 
67  throw new NoSuchServiceException("The requested service " . $fullyQualifiedDomainName
68  . " could not be resolved.");
69  }
70 }
getDependency(Container $DIC, $fullyQualifiedDomainName, $for)
The DIC to take the dependencies from. What domain name is requested? What class is the dependency fo...
$result
global $DIC
Definition: saml.php:7
getDependencyWith(Container $DIC, $fullyQualifiedDomainName, $for, callable $map)
The DIC to take the dependencies from. What domain name is requested? (DIC $DIC, string $fullyQualifi...
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:16
with(callable $map)
Returns a new dependency map with the given mapping.