public function dispatchClosure(Dispatch $dispatch, array $arguments = null)
    {
        // Ensure a closure exists before continuing
        if (null === $dispatch->getClosure()) {
            return $dispatch->getClosure();
        }

        $closure  = $dispatch->getClosure();
        $response = null;

        // If there are arguments
        if (null !== $arguments) {
            // Unpack arguments and dispatch
            $response = $closure(...$arguments);
        } else {
            // Dispatch without unpacking
            $response = $closure();
        }

        return $response ?? $this->DISPATCHED;
    }
public function dispatchClosure(Dispatch $dispatch, array $arguments = null)
    {
        // Ensure a closure exists before continuing
        if (null === $dispatch->getClosure()) {
            return $dispatch->getClosure();
        }

        $closure  = $dispatch->getClosure();
        $response = null;

        // If there are arguments
        if (null !== $arguments) {
            // Unpack arguments and dispatch
            $response = $closure(...$arguments);
        } else {
            // Dispatch without unpacking
            $response = $closure();
        }

        return $response ?? $this->DISPATCHED;
    }
public function dispatchClosure ( Dispatch $ dispatch , array $ arguments = null ) { // Ensure a closure exists before continuing if ( null === $ dispatch -> getClosure ( ) ) { return $ dispatch -> getClosure ( ) ; } $ closure = $ dispatch -> getClosure ( ) ; $ response = null ; // If there are arguments if ( null !== $ arguments ) { // Unpack arguments and dispatch $ response = $ closure ( ... $ arguments ) ; } else { // Dispatch without unpacking $ response = $ closure ( ) ; } return $ response ?? $ this -> DISPATCHED ; }
Dispatch a closure.

@param Dispatch $dispatch  The dispatch
@param array    $arguments [optional] The arguments

@return mixed
Dispatch a closure .