src/Container.php
public function call(callable $callback, array $args = []) {
        $instance = null;

        if (is_array($callback)) {
            $function = new \ReflectionMethod($callback[0], $callback[1]);

            if (is_object($callback[0])) {
                $instance = $callback[0];
            }
        } else {
            $function = new \ReflectionFunction($callback);
        }

        $args = $this->resolveArgs($this->makeDefaultArgs($function, $args), [], $instance);

        return call_user_func_array($callback, $args);
    }
public function call(callable $callback, array $args = []) {
        $instance = null;

        if (is_array($callback)) {
            $function = new \ReflectionMethod($callback[0], $callback[1]);

            if (is_object($callback[0])) {
                $instance = $callback[0];
            }
        } else {
            $function = new \ReflectionFunction($callback);
        }

        $args = $this->resolveArgs($this->makeDefaultArgs($function, $args), [], $instance);

        return call_user_func_array($callback, $args);
    }
public function call ( callable $ callback , array $ args = [ ] ) { $ instance = null ; if ( is_array ( $ callback ) ) { $ function = new \ ReflectionMethod ( $ callback [ 0 ] , $ callback [ 1 ] ) ; if ( is_object ( $ callback [ 0 ] ) ) { $ instance = $ callback [ 0 ] ; } } else { $ function = new \ ReflectionFunction ( $ callback ) ; } $ args = $ this -> resolveArgs ( $ this -> makeDefaultArgs ( $ function , $ args ) , [ ] , $ instance ) ; return call_user_func_array ( $ callback , $ args ) ; }
Call a callback with argument injection.

@param callable $callback The callback to call.
@param array $args Additional arguments to pass to the callback.
@return mixed Returns the result of the callback.
@throws ContainerException Throws an exception if the callback cannot be understood.
Call a callback with argument injection .