public function invoke(callable $callback, $params = [])
    {
        if (is_callable($callback)) {
            return call_user_func_array($callback, $this->resolveCallableDependencies($callback, $params));
        } else {
            return call_user_func_array($callback, $params);
        }
    }
public function invoke(callable $callback, $params = [])
    {
        if (is_callable($callback)) {
            return call_user_func_array($callback, $this->resolveCallableDependencies($callback, $params));
        } else {
            return call_user_func_array($callback, $params);
        }
    }
public function invoke ( callable $ callback , $ params = [ ] ) { if ( is_callable ( $ callback ) ) { return call_user_func_array ( $ callback , $ this -> resolveCallableDependencies ( $ callback , $ params ) ) ; } else { return call_user_func_array ( $ callback , $ params ) ; } }
Invoke a callback with resolving dependencies in parameters.

This methods allows invoking a callback and let type hinted parameter names to be
resolved as objects of the Container. It additionally allow calling function using named parameters.

For example, the following callback may be invoked using the Container to resolve the formatter dependency:

```php
$formatString = function($string, \yii\i18n\Formatter $formatter) {
// ...
}
Yii::$container->invoke($formatString, ['string' => 'Hello World!']);
```

This will pass the string `'Hello World!'` as the first param, and a formatter instance created
by the DI container as the second param to the callable.

@param callable $callback callable to be invoked.
@param array $params The array of parameters for the function.
This can be either a list of parameters, or an associative array representing named function parameters.
@return mixed the callback return value.
@throws InvalidConfigException if a dependency cannot be resolved or if a dependency cannot be fulfilled.
@since 2.0.7
Invoke a callback with resolving dependencies in parameters .