Skip to content

Commit

Permalink
Merge pull request #2 from utopia-php/feat-framework-v2
Browse files Browse the repository at this point in the history
Feat framework v2
  • Loading branch information
christyjacob4 authored Aug 8, 2024
2 parents a0c8be6 + 74596e0 commit 22490c9
Showing 1 changed file with 20 additions and 5 deletions.
25 changes: 20 additions & 5 deletions src/DI/Container.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ public function set(Dependency|Injection $dependency): self

/**
* Get a dependency.
*
*
* @param string $name
*
*
* @return mixed
*/
public function get(string $name): mixed
Expand All @@ -67,9 +67,9 @@ public function get(string $name): mixed

/**
* Check if a dependency exists.
*
*
* @param string $name
*
*
* @return bool
*/
public function has(string $name): bool
Expand All @@ -82,7 +82,7 @@ public function has(string $name): bool
*
* @param Injection $injection
* @param bool $fresh
*
*
* @return mixed
*/
public function inject(Injection $injection, bool $fresh = false): mixed // Route
Expand Down Expand Up @@ -114,4 +114,19 @@ public function inject(Injection $injection, bool $fresh = false): mixed // Rout

return $resolved;
}
/**
* Refresh a dependency
*
* @param string $name
* @return self
* @throws Exception
*/
public function refresh(string $name): self
{
if(\array_key_exists($name, $this->instances)) {
unset($this->instances[$name]);
}

return $this;
}
}

0 comments on commit 22490c9

Please sign in to comment.