Skip to content

Commit

Permalink
add: rebind
Browse files Browse the repository at this point in the history
  • Loading branch information
Player626 authored and RunsTp committed Mar 15, 2021
1 parent 3c598aa commit 8794b95
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/Kernel/ServiceContainer.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ public function __construct(array $config = null, string $name = null, array $va
$this->registerProviders($this->getProviders());
}

public function getName():string
public function getName(): string
{
return $this->name;
}

public function getConfig():array
public function getConfig(): array
{
return $this->config ?? [];
}
Expand All @@ -51,6 +51,12 @@ public function registerProviders(array $providers)
}
}

public function rebind($name, $value)
{
$this->offsetUnset($name);
$this->offsetSet($name, $value);
}

public function __get($name)
{
return $this->offsetGet($name);
Expand All @@ -60,4 +66,4 @@ public function __set($name, $value)
{
$this->offsetSet($name, $value);
}
}
}

0 comments on commit 8794b95

Please sign in to comment.