private function setCode($code, $silent = false)
    {
        if ($this->hasCode()) {
            $this->codeStack[] = [$this->codeBuffer, $this->codeBufferOpen, $this->code];
        }

        $this->resetCodeBuffer();
        try {
            $this->addCode($code, $silent);
        } catch (\Throwable $e) {
            $this->popCodeStack();

            throw $e;
        } catch (\Exception $e) {
            $this->popCodeStack();

            throw $e;
        }

        if (!$this->hasValidCode()) {
            $this->popCodeStack();

            throw new \InvalidArgumentException('Unexpected end of input');
        }
    }
private function setCode($code, $silent = false)
    {
        if ($this->hasCode()) {
            $this->codeStack[] = [$this->codeBuffer, $this->codeBufferOpen, $this->code];
        }

        $this->resetCodeBuffer();
        try {
            $this->addCode($code, $silent);
        } catch (\Throwable $e) {
            $this->popCodeStack();

            throw $e;
        } catch (\Exception $e) {
            $this->popCodeStack();

            throw $e;
        }

        if (!$this->hasValidCode()) {
            $this->popCodeStack();

            throw new \InvalidArgumentException('Unexpected end of input');
        }
    }
private function setCode ( $ code , $ silent = false ) { if ( $ this -> hasCode ( ) ) { $ this -> codeStack [ ] = [ $ this -> codeBuffer , $ this -> codeBufferOpen , $ this -> code ] ; } $ this -> resetCodeBuffer ( ) ; try { $ this -> addCode ( $ code , $ silent ) ; } catch ( \ Throwable $ e ) { $ this -> popCodeStack ( ) ; throw $ e ; } catch ( \ Exception $ e ) { $ this -> popCodeStack ( ) ; throw $ e ; } if ( ! $ this -> hasValidCode ( ) ) { $ this -> popCodeStack ( ) ; throw new \ InvalidArgumentException ( 'Unexpected end of input' ) ; } }
Set the code buffer.

This is mostly used by `Shell::execute`. Any existing code in the input
buffer is pushed onto a stack and will come back after this new code is
executed.

@throws \InvalidArgumentException if $code isn't a complete statement

@param string $code
@param bool   $silent
Set the code buffer .