protected function instanciate($key, $parameters = null)
    {

        if ($key instanceof \Closure) {
            return call_user_func_array($key, $parameters);
        }

        $reflection = new \ReflectionClass($key);
        return $reflection->newInstanceArgs($parameters);
    }
protected function instanciate($key, $parameters = null)
    {

        if ($key instanceof \Closure) {
            return call_user_func_array($key, $parameters);
        }

        $reflection = new \ReflectionClass($key);
        return $reflection->newInstanceArgs($parameters);
    }
protected function instanciate ( $ key , $ parameters = null ) { if ( $ key instanceof \ Closure ) { return call_user_func_array ( $ key , $ parameters ) ; } $ reflection = new \ ReflectionClass ( $ key ) ; return $ reflection -> newInstanceArgs ( $ parameters ) ; }
Instantiate an instance of the given type.

@param  string $key
@param  array  $parameters

@throws \Exception
@return mixed
Instantiate an instance of the given type .