From 6d391c78f23c589c62f35c0864b8a12f57bad037 Mon Sep 17 00:00:00 2001 From: Juan Cristobal <65052633+juancristobalgd1@users.noreply.github.com> Date: Sun, 4 Aug 2024 18:25:56 +0200 Subject: [PATCH] Update Container.php --- src/Container.php | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/Container.php b/src/Container.php index 3a2cd26..5c98dea 100644 --- a/src/Container.php +++ b/src/Container.php @@ -17,9 +17,8 @@ class Container public static function getInstance() { - if (!isset(static::$instances)) { + if (!isset(static::$instances)) static::$instances = new self(); - } return static::$instances; } @@ -32,18 +31,16 @@ public function bind(string $key, mixed $value): mixed public function singleton(string $key, object $value) { - if (!$this->has($key)) { + if (!$this->has($key)) return $this->bind($key, $value); - } return $this->storage[$key]; } public function key(string $key) { - if ($this->has($key)) { + if ($this->has($key)) return $key; - } throw new \Exception("Key '{$key}' not found in container."); }