Fix bug in IoC.
This commit is contained in:
parent
348ff778ed
commit
9d1d48fb4f
|
@ -24,8 +24,10 @@ class IoC {
|
||||||
* @param bool $singleton
|
* @param bool $singleton
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public static function register($name, $resolver, $singleton = false)
|
public static function register($name, $resolver = null, $singleton = false)
|
||||||
{
|
{
|
||||||
|
if (is_null($resolver)) $resolver = $name;
|
||||||
|
|
||||||
static::$registry[$name] = compact('resolver', 'singleton');
|
static::$registry[$name] = compact('resolver', 'singleton');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,7 +51,7 @@ public static function registered($name)
|
||||||
* @param Closure $resolver
|
* @param Closure $resolver
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public static function singleton($name, $resolver)
|
public static function singleton($name, $resolver = null)
|
||||||
{
|
{
|
||||||
static::register($name, $resolver, true);
|
static::register($name, $resolver, true);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue