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

        $function = $dispatch->getFunction();
        $response = null;

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

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

        $function = $dispatch->getFunction();
        $response = null;

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

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

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

@return mixed
Dispatch a function .