ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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}
getDependency(Container $DIC, string $fullyQualifiedDomainName, string $for)
mixed
getDependencyWith(Container $DIC, string $fullyQualifiedDomainName, string $for, callable $map)
mixed
with(callable $map)
Returns a new dependency map with the given mapping.
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:36
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
global $DIC
Definition: shib_login.php:26