public function resolveMethod($instance, string $method, array $parameters = [])
    {
        $name = get_class($instance);
        $reflection = new \ReflectionMethod($name, $method);

        $dependencies = $reflection->getParameters();
        $instances = $this->resolveDependencies($dependencies, $parameters); // Actually resolve the dependencies
        $o = $reflection->invokeArgs($instance, $instances);

        return $o;
    }
public function resolveMethod($instance, string $method, array $parameters = [])
    {
        $name = get_class($instance);
        $reflection = new \ReflectionMethod($name, $method);

        $dependencies = $reflection->getParameters();
        $instances = $this->resolveDependencies($dependencies, $parameters); // Actually resolve the dependencies
        $o = $reflection->invokeArgs($instance, $instances);

        return $o;
    }
public function resolveMethod ( $ instance , string $ method , array $ parameters = [ ] ) { $ name = get_class ( $ instance ) ; $ reflection = new \ ReflectionMethod ( $ name , $ method ) ; $ dependencies = $ reflection -> getParameters ( ) ; $ instances = $ this -> resolveDependencies ( $ dependencies , $ parameters ) ; // Actually resolve the dependencies $ o = $ reflection -> invokeArgs ( $ instance , $ instances ) ; return $ o ; }
Calls the method of an instance after resolving dependencies
@param object $instance Instance to use when calling method
@param string $method Name of the method
@param array $parameters Pre-given data to fill slots that have no default value
@return mixed Value returned in method
@since 1.0.0
Calls the method of an instance after resolving dependencies