src/Register.php
public function singletonFactory($namespace, array $args = [], $name = null)
    {
        if (is_null($name)) {
            $name = $namespace;
        }

        if (!isset($this->singletons[$name])) {
            $this->singletons[$name] = $this->factory($namespace, $args);
        }

        $this->callEvent(
            'register_before_return_singleton',
            [$this->singletons[$name], $args, $name]
        );

        return $this->singletons[$name];
    }
public function singletonFactory($namespace, array $args = [], $name = null)
    {
        if (is_null($name)) {
            $name = $namespace;
        }

        if (!isset($this->singletons[$name])) {
            $this->singletons[$name] = $this->factory($namespace, $args);
        }

        $this->callEvent(
            'register_before_return_singleton',
            [$this->singletons[$name], $args, $name]
        );

        return $this->singletons[$name];
    }
public function singletonFactory ( $ namespace , array $ args = [ ] , $ name = null ) { if ( is_null ( $ name ) ) { $ name = $ namespace ; } if ( ! isset ( $ this -> singletons [ $ name ] ) ) { $ this -> singletons [ $ name ] = $ this -> factory ( $ namespace , $ args ) ; } $ this -> callEvent ( 'register_before_return_singleton' , [ $ this -> singletons [ $ name ] , $ args , $ name ] ) ; return $ this -> singletons [ $ name ] ; }
create singleton instance of given class

@param string $namespace
@param array $args
@param null|string $name
@return mixed
@throws \InvalidArgumentException
@throws RegisterException
create singleton instance of given class