ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
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}
$result
An exception for terminatinating execution or to throw for unit testing.
getDependencyWith(Container $DIC, $fullyQualifiedDomainName, $for, callable $map)
mixed
with(callable $map)
Returns a new dependency map with the given mapping.
getDependency(Container $DIC, $fullyQualifiedDomainName, $for)
mixed
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:18
$DIC
Definition: xapitoken.php:46