src/Launcher.php
public function waitFor(AbstractDialog $dialog)
    {
        $done = false;
        $ret  = null;
        $loop = $this->loop;

        $process = $this->launch($dialog);

        $process->then(function ($result) use (&$ret, &$done, $loop) {
            $ret = $result;
            $done = true;

            $loop->stop();
        }, function () use (&$ret, &$done, $loop) {
            $ret = false;
            $done = true;

            $loop->stop();
        });

        if (!$done) {
            $loop->run();
        }

        return $ret;
    }
public function waitFor(AbstractDialog $dialog)
    {
        $done = false;
        $ret  = null;
        $loop = $this->loop;

        $process = $this->launch($dialog);

        $process->then(function ($result) use (&$ret, &$done, $loop) {
            $ret = $result;
            $done = true;

            $loop->stop();
        }, function () use (&$ret, &$done, $loop) {
            $ret = false;
            $done = true;

            $loop->stop();
        });

        if (!$done) {
            $loop->run();
        }

        return $ret;
    }
public function waitFor ( AbstractDialog $ dialog ) { $ done = false ; $ ret = null ; $ loop = $ this -> loop ; $ process = $ this -> launch ( $ dialog ) ; $ process -> then ( function ( $ result ) use ( & $ ret , & $ done , $ loop ) { $ ret = $ result ; $ done = true ; $ loop -> stop ( ) ; } , function ( ) use ( & $ ret , & $ done , $ loop ) { $ ret = false ; $ done = true ; $ loop -> stop ( ) ; } ) ; if ( ! $ done ) { $ loop -> run ( ) ; } return $ ret ; }
Block while waiting for the given dialog to return

If the dialog is already closed, this returns immediately, without doing
much at all. If the dialog is not yet opened, it will be opened and this
method will wait for the dialog to be handled (i.e. either completed or
closed). Clicking "ok" will result in a boolean true value, clicking
"cancel" or hitten escape key will or running into a timeout will result
in a boolean false. For all other input fields, their respective (parsed)
value will be returned.

For this to work, this method will temporarily start the event loop and
stop it afterwards. Thus, it is *NOT* a good idea to mix this if anything
else is listening on the event loop. The recommended way in this case is
to avoid using this blocking method call and go for a fully async
`self::then()` instead.

@param AbstractDialog $dialog
@return boolean|string dialog return value
@uses Launcher::waitFor()
Block while waiting for the given dialog to return