public function executeWith($callable, $handler = null)
    {
        $handlers = $this->clear();

        if (null !== $handler) {
            $this->push($handler);
        }

        $error = null;

        try {
            $result = $callable();
        } catch (Exception $error) {
            // re-thrown after handlers are restored
        }

        $this->restore($handlers);

        if (null !== $error) {
            throw $error;
        }

        return $result;
    }
public function executeWith($callable, $handler = null)
    {
        $handlers = $this->clear();

        if (null !== $handler) {
            $this->push($handler);
        }

        $error = null;

        try {
            $result = $callable();
        } catch (Exception $error) {
            // re-thrown after handlers are restored
        }

        $this->restore($handlers);

        if (null !== $error) {
            throw $error;
        }

        return $result;
    }
public function executeWith ( $ callable , $ handler = null ) { $ handlers = $ this -> clear ( ) ; if ( null !== $ handler ) { $ this -> push ( $ handler ) ; } $ error = null ; try { $ result = $ callable ( ) ; } catch ( Exception $ error ) { // re-thrown after handlers are restored } $ this -> restore ( $ handlers ) ; if ( null !== $ error ) { throw $ error ; } return $ result ; }
Temporarily bypass the current handler stack and execute a callable with
the supplied handler.

This method is useful for executing PHP code that relies upon handling
techniques that are incompatible with Asplode

@param callable      $callable The callable to invoke.
@param callable|null $handler  The handler to use.

@return mixed     The result of the callable's invocation.
@throws Exception If the callable throws an exception.
Temporarily bypass the current handler stack and execute a callable with the supplied handler .