|
@@ 39-47 (lines=9) @@
|
| 36 |
|
$this->injectAliases($injector, $dependencies); |
| 37 |
|
} |
| 38 |
|
|
| 39 |
|
private function injectAliases(Injector $injector, array $dependencies): void |
| 40 |
|
{ |
| 41 |
|
$aliases = $dependencies['aliases'] ?? []; |
| 42 |
|
foreach ($aliases as $alias => $target) { |
| 43 |
|
// Standard Auryn aliases do not work when chained. Work around by |
| 44 |
|
// lazily fetching the shared target from the container. |
| 45 |
|
$injector->share($alias)->share($target)->delegate($alias, $this->makeContainerGet($target)); |
| 46 |
|
} |
| 47 |
|
} |
| 48 |
|
|
| 49 |
|
private function injectFactories(Injector $injector, array $dependencies): void |
| 50 |
|
{ |
|
@@ 86-92 (lines=7) @@
|
| 83 |
|
} |
| 84 |
|
} |
| 85 |
|
|
| 86 |
|
private function injectServices(Injector $injector, array $dependencies): void |
| 87 |
|
{ |
| 88 |
|
$services = $dependencies['services'] ?? []; |
| 89 |
|
foreach ($services as $name => $service) { |
| 90 |
|
$injector->share($name)->delegate($name, $this->makeIdentity($service)); |
| 91 |
|
} |
| 92 |
|
} |
| 93 |
|
|
| 94 |
|
private function makeDelegator(Injector $injector, string $name, callable $callback, array $delegators): callable |
| 95 |
|
{ |