Skip to content

Commit 9cc333b

Browse files
committed
updated
1 parent c23ae13 commit 9cc333b

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

src/Container.php

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ public function set(string $id, $concrete = null)
2929
$concrete = $id;
3030
}
3131

32+
if (is_string($concrete) && class_exists($concrete)) {
33+
$concrete = $this->resolve($concrete);
34+
}
35+
3236
return $this->instance[$id] = $concrete;
3337
}
3438

@@ -40,16 +44,8 @@ public function get(string $id)
4044
if(!$this->has($id)){
4145
$this->set($id);
4246
}
43-
$instance = $this->instance[$id];
44-
if (is_object($instance)) {
45-
return $instance;
46-
}
47-
48-
if (is_string($instance) && class_exists($instance)) {
49-
return $this->set($id, $this->resolve($instance));
50-
}
5147

52-
return $instance;
48+
return $this->instance[$id];
5349
}
5450

5551
/**

0 commit comments

Comments
 (0)