|
@@ 42-50 (lines=9) @@
|
| 39 |
|
$this->injectAliases($injector, $dependencies); |
| 40 |
|
} |
| 41 |
|
|
| 42 |
|
private function injectAliases(Injector $injector, array $dependencies): void |
| 43 |
|
{ |
| 44 |
|
$aliases = $dependencies['aliases'] ?? []; |
| 45 |
|
foreach ($aliases as $alias => $target) { |
| 46 |
|
// Standard Auryn aliases do not work when chained. Work around by |
| 47 |
|
// lazily fetching the shared target from the container. |
| 48 |
|
$injector->share($alias)->share($target)->delegate($alias, $this->makeLazy($target)); |
| 49 |
|
} |
| 50 |
|
} |
| 51 |
|
|
| 52 |
|
private function injectFactories(Injector $injector, array $dependencies): void |
| 53 |
|
{ |
|
@@ 95-101 (lines=7) @@
|
| 92 |
|
} |
| 93 |
|
} |
| 94 |
|
|
| 95 |
|
private function injectServices(Injector $injector, array $dependencies): void |
| 96 |
|
{ |
| 97 |
|
$services = $dependencies['services'] ?? []; |
| 98 |
|
foreach ($services as $name => $service) { |
| 99 |
|
$injector->share($name)->delegate($name, $this->makeIdentity($service)); |
| 100 |
|
} |
| 101 |
|
} |
| 102 |
|
|
| 103 |
|
private function makeDelegator(Injector $injector, string $name, callable $callback, array $delegators): callable |
| 104 |
|
{ |