ILIAS  release_8 Revision v8.24
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 } else {
42 return $this->getDependency($DIC, $fullyQualifiedDomainName, $for);
43 }
44 }
45
51 public function with(callable $map): DependencyMap
52 {
53 $dependency_map = new static();
54 $dependency_map->maps = array_merge([$map], $this->maps);
55
56 return $dependency_map;
57 }
58
62 public function getDependency(Container $DIC, string $fullyQualifiedDomainName, string $for)
63 {
64 foreach ($this->maps as $map) {
65 $result = $map($DIC, $fullyQualifiedDomainName, $for);
66 if ($result) {
67 return $result;
68 }
69 }
70
71 throw new NoSuchServiceException("The requested service " . $fullyQualifiedDomainName
72 . " could not be resolved.");
73 }
74}
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:32
global $DIC
Definition: feed.php:28
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...