public function getInput()
    {
        $this->codeBufferOpen = false;

        do {
            // reset output verbosity (in case it was altered by a subcommand)
            $this->output->setVerbosity(ShellOutput::VERBOSITY_VERBOSE);

            $input = $this->readline();

            /*
             * Handle Ctrl+D. It behaves differently in different cases:
             *
             *   1) In an expression, like a function or "if" block, clear the input buffer
             *   2) At top-level session, behave like the exit command
             */
            if ($input === false) {
                $this->output->writeln('');

                if ($this->hasCode()) {
                    $this->resetCodeBuffer();
                } else {
                    throw new BreakException('Ctrl+D');
                }
            }

            // handle empty input
            if (\trim($input) === '' && !$this->codeBufferOpen) {
                continue;
            }

            $input = $this->onInput($input);

            // If the input isn't in an open string or comment, check for commands to run.
            if ($this->hasCommand($input) && !$this->inputInOpenStringOrComment($input)) {
                $this->addHistory($input);
                $this->runCommand($input);

                continue;
            }

            $this->addCode($input);
        } while (!$this->hasValidCode());
    }
public function getInput()
    {
        $this->codeBufferOpen = false;

        do {
            // reset output verbosity (in case it was altered by a subcommand)
            $this->output->setVerbosity(ShellOutput::VERBOSITY_VERBOSE);

            $input = $this->readline();

            /*
             * Handle Ctrl+D. It behaves differently in different cases:
             *
             *   1) In an expression, like a function or "if" block, clear the input buffer
             *   2) At top-level session, behave like the exit command
             */
            if ($input === false) {
                $this->output->writeln('');

                if ($this->hasCode()) {
                    $this->resetCodeBuffer();
                } else {
                    throw new BreakException('Ctrl+D');
                }
            }

            // handle empty input
            if (\trim($input) === '' && !$this->codeBufferOpen) {
                continue;
            }

            $input = $this->onInput($input);

            // If the input isn't in an open string or comment, check for commands to run.
            if ($this->hasCommand($input) && !$this->inputInOpenStringOrComment($input)) {
                $this->addHistory($input);
                $this->runCommand($input);

                continue;
            }

            $this->addCode($input);
        } while (!$this->hasValidCode());
    }
public function getInput ( ) { $ this -> codeBufferOpen = false ; do { // reset output verbosity (in case it was altered by a subcommand) $ this -> output -> setVerbosity ( ShellOutput :: VERBOSITY_VERBOSE ) ; $ input = $ this -> readline ( ) ; /*
             * Handle Ctrl+D. It behaves differently in different cases:
             *
             *   1) In an expression, like a function or "if" block, clear the input buffer
             *   2) At top-level session, behave like the exit command
             */ if ( $ input === false ) { $ this -> output -> writeln ( '' ) ; if ( $ this -> hasCode ( ) ) { $ this -> resetCodeBuffer ( ) ; } else { throw new BreakException ( 'Ctrl+D' ) ; } } // handle empty input if ( \ trim ( $ input ) === '' && ! $ this -> codeBufferOpen ) { continue ; } $ input = $ this -> onInput ( $ input ) ; // If the input isn't in an open string or comment, check for commands to run. if ( $ this -> hasCommand ( $ input ) && ! $ this -> inputInOpenStringOrComment ( $ input ) ) { $ this -> addHistory ( $ input ) ; $ this -> runCommand ( $ input ) ; continue ; } $ this -> addCode ( $ input ) ; } while ( ! $ this -> hasValidCode ( ) ) ; }
Read user input.

This will continue fetching user input until the code buffer contains
valid code.

@throws BreakException if user hits Ctrl+D
Read user input .