public static function methodDI(array $objectInfo, \Closure $callback = null)
    {
        $reflection     = new \ReflectionObject($objectInfo[0]);
        $methods        = $reflection->getMethods();
        $inputParams    = [];
        $functionParams = [];
        foreach ($methods as $method) {
            if ($objectInfo[1] == $method->name) {
                $functionParams = $method->getParameters();
                break;
            }
        }
        foreach ($functionParams as $functionParam) {
            $param = $callback($functionParam->name);
            if (!empty($param)) {
                $inputParams[] = $param;
            }
        }
        return call_user_func_array($objectInfo, $inputParams);
    }
public static function methodDI(array $objectInfo, \Closure $callback = null)
    {
        $reflection     = new \ReflectionObject($objectInfo[0]);
        $methods        = $reflection->getMethods();
        $inputParams    = [];
        $functionParams = [];
        foreach ($methods as $method) {
            if ($objectInfo[1] == $method->name) {
                $functionParams = $method->getParameters();
                break;
            }
        }
        foreach ($functionParams as $functionParam) {
            $param = $callback($functionParam->name);
            if (!empty($param)) {
                $inputParams[] = $param;
            }
        }
        return call_user_func_array($objectInfo, $inputParams);
    }
public static function methodDI ( array $ objectInfo , \ Closure $ callback = null ) { $ reflection = new \ ReflectionObject ( $ objectInfo [ 0 ] ) ; $ methods = $ reflection -> getMethods ( ) ; $ inputParams = [ ] ; $ functionParams = [ ] ; foreach ( $ methods as $ method ) { if ( $ objectInfo [ 1 ] == $ method -> name ) { $ functionParams = $ method -> getParameters ( ) ; break ; } } foreach ( $ functionParams as $ functionParam ) { $ param = $ callback ( $ functionParam -> name ) ; if ( ! empty ( $ param ) ) { $ inputParams [ ] = $ param ; } } return call_user_func_array ( $ objectInfo , $ inputParams ) ; }
Call method with dependency injection

@param array $objectInfo
@param \Closure $callback
@return mixed
Call method with dependency injection