Vinelab\Minion\Client::wrapWithProxy PHP Method

wrapWithProxy() public method

The reason we use this is to be able to format the given $data into a Dictionary which makes it safer to work with them.
public wrapWithProxy ( mixed $callback, boolean $isFunction = false ) : Closure
$callback mixed
$isFunction boolean
return Closure
    public function wrapWithProxy($callback, $isFunction = false)
    {
        // Save provider context for resolving method by name with many providers use
        $provider = $this->getDelegateProvider();
        // We will wrap the callback with a Closure so that we can format the kwArgs that we receive
        // into our proprietary Dictionary instance to make things safer.
        return function ($args, $kwArgs) use($callback, $isFunction, $provider) {
            if (is_string($callback) && !$isFunction && $provider instanceof Provider) {
                $callback = [$provider, $callback];
            }
            return call_user_func_array($callback, [$args, Dictionary::make($kwArgs)]);
        };
    }