chore: complete update
This commit is contained in:
36
src/Framework/DI/BindingRegistry.php
Normal file
36
src/Framework/DI/BindingRegistry.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace App\Framework\DI;
|
||||
|
||||
/**
|
||||
* Verwaltet alle Service-Bindings
|
||||
*/
|
||||
final class BindingRegistry
|
||||
{
|
||||
private array $bindings = [];
|
||||
|
||||
public function bind(string $abstract, callable|string|object $concrete): void
|
||||
{
|
||||
$this->bindings[$abstract] = $concrete;
|
||||
}
|
||||
|
||||
public function hasBinding(string $abstract): bool
|
||||
{
|
||||
return isset($this->bindings[$abstract]);
|
||||
}
|
||||
|
||||
public function getBinding(string $abstract): callable|string|object|null
|
||||
{
|
||||
return $this->bindings[$abstract] ?? null;
|
||||
}
|
||||
|
||||
public function forget(string $abstract): void
|
||||
{
|
||||
unset($this->bindings[$abstract]);
|
||||
}
|
||||
|
||||
public function getAllBindings(): array
|
||||
{
|
||||
return array_keys($this->bindings);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user