Returns the current output of the process (STDOUT).

@return string The process output

@throws LogicException in case the output has been disabled
@throws LogicException In case the process is not started
162878
public function getOutput()
    {
        $this->readPipesForOutput(__FUNCTION__);

        if (false === $ret = stream_get_contents($this->stdout, -1, 0)) {
            return '';
        }

        return $ret;
    }
438597
public function getOutput() {
		// create stream handle for the output
		$handle = fopen('php://temp/maxmemory:'.(1*1024*1024), 'r+'); // 1MB

		foreach ($this->_content['content'] as $nr => $row) {
			// use first row for headlines
			if ($nr == 0 && $this->table_header === true) {
				fwrite($handle, $this -> _createRow(array_keys($row)));
			}

			fwrite($handle, $this -> _createRow($row));
		}

		return $handle;
	}
288594
public function read()
    {
        if (!$this->connected()) {
            throw new LogicException('No connection');
        }

        $streams = [$this->connection];
        $write = $except = null;
        $streamsReadyToRead = stream_select($streams, $write, $except, 0, self::READ_TIMEOUT);
        if ($streamsReadyToRead > 0) {
            return stream_get_contents($this->connection);
        }
    }
846634
public function start()
    {
        if (!empty($this->pid) && $this->isRunning()) {
            throw new \LogicException("the process is already running");
        }

        $callback = $this->getCallable();

        $pid = pcntl_fork();
        if ($pid < 0) {
            throw new \RuntimeException("fork error");
        } elseif ($pid > 0) {
            $this->pid = $pid;
            $this->running = true;
            $this->started = true;
        } else {
            $this->pid = getmypid();
            $this->signal();
            foreach ($this->signal_handlers as $signal => $handler) {
                pcntl_signal($signal, $handler);
            }
            call_user_func($callback);
            exit(0);
        }
    }
571918
public function getLastReturn()
    {
        if (!$this->entries) {
            throw new \LogicException('No entries');
        }

        $last = end($this->entries);

        if (isset($last['result'])) {
            return $last['result'];
        } elseif (isset($last['exception'])) {
            return $last['exception'];
        } else {
            throw new \LogicException('No return value for last entry.');
        }
    }
1201036
public function tell(): int
    {
        if (null === $this->handle) {
            throw new \LogicException('Can not read from closed input stream.');
        }

        $position = @ftell($this->handle);
        if (false === $position) {
            throw new StreamException(
                    'Can not read current position in file: '
                    . lastErrorMessage('unknown error')
            );
        }

        return $position;
    }
1212270
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());
    }
805157
public function getBody()
    {
        if ($this->isMultiPart()) {
            throw new \LogicException("MultiPart content, there aren't body");
        }

        $body = stream_get_contents($this->stream, -1, $this->bodyOffset);

        // Decode
        $encoding = strtolower($this->getHeader('Content-Transfer-Encoding'));
        switch ($encoding) {
            case 'base64':
                $body = base64_decode($body);
                break;
            case 'quoted-printable':
                $body = quoted_printable_decode($body);
                break;
        }

        // Convert to UTF-8 ( Not if binary or 7bit ( aka Ascii ) )
        if (false === in_array($encoding, array('binary', '7bit'))) {
            // Charset
            $contentType = $this->getHeader('Content-Type');
            $charset = self::getHeaderOption($contentType, 'charset');
            if (null === $charset) {
                // Try to detect
                $charset = mb_detect_encoding($body) ?: 'utf-8';
            }

            // Only convert if not UTF-8
            if ('utf-8' !== strtolower($charset)) {
                $body = mb_convert_encoding($body, 'utf-8', $charset);
            }
        }

        return $body;
    }
290574
public function getState()
    {
        if (empty($this->state)) {
            throw new LogicException(
                sprintf(self::ERROR_MISSING_ATTRIBUTE_FORMAT, 'state')
            );
        }
        return $this->state;
    }
691671
private function parse(){
        if(self::$parser === null){
            self::$parser   = (new ParserFactory())
                ->create(\PhpParser\ParserFactory::ONLY_PHP7);
        }

        $stmt   = self::$parser->parse(file_get_contents($this->path));

        if(!is_array($stmt)){
            throw new \LogicException;
        }

        $stmt   = array_filter($stmt, function($v){
            return $v instanceof \PhpParser\Node\Stmt\Namespace_;
        });

        if(empty($stmt)){
            throw new \LogicException;
        }

        $this->namespace    = implode("\\", $stmt[0]->name->parts);

        foreach($stmt[0]->stmts as $sub_stmt){
            if($sub_stmt instanceof \PhpParser\Node\Stmt\Use_
                || $sub_stmt instanceof \PhpParser\Node\Stmt\GroupUse
            ){
                $prefix = "";

                if($sub_stmt instanceof \PhpParser\Node\Stmt\GroupUse){
                    $prefix = $sub_stmt->prefix;
                }

                foreach($sub_stmt->uses as $use){
                    $name   = implode("\\", $use->name->parts);
                    $alias  = $use->alias;

                    if($prefix !== ""){
                        $name   = "{$prefix}\\{$name}";
                    }

                    $this->uses[$name]  = $alias;
                }
            }else if($sub_stmt instanceof \PhpParser\Node\Stmt\Class_){
                $this->class    = $sub_stmt->name;
            }
        }
    }
1032511
public function getDescription()
    {
        if (empty($this->description)) {
            throw new LogicException(
                sprintf(self::ERROR_MISSING_ATTRIBUTE_FORMAT, 'description')
            );
        }
        return $this->description;
    }
1235850
public function stream()
    {

        // filesystem
        if( isset( $this->filePath ) ) {

            return readfile( $this->filePath );

        } elseif ( $this->oid ) {

            $pg = $this->oid->pg;

            $pg->query( new Query( 'BEGIN' ) );

            $handle = pg_lo_open( $pg->resource->get(), $this->oid->oid, 'r' );

            pg_lo_read_all( $handle );
            pg_lo_close( $handle );

            $pg->query( new Query( 'COMMIT' ) );

            return null;

        }

        throw \LogicException("Shouldn't ever get tripped");

    }
1031641
String getProcErrorOutput(Process proc) throws IOException {
        StringBuffer output = new StringBuffer();

        InputStream procIn = proc.getInputStream();
        int read;
        // Dump the data printed by the process
        do {
            byte[] buffer = new byte[BUFFER_SIZE];
            read = procIn.read(buffer);
            String s = new String(buffer);
            output.append(s);
        } while (read == BUFFER_SIZE);

        return output.toString();
    }
1130242
private function resultCallHasOutput()
    {
        if (!$this->result instanceof ExecutedStepResult) {
            return false;
        }

        return $this->result->getCallResult()->hasStdOut() || $this->result->getCallResult()->hasException();
    }
935550
public function outputType()
    {
        if ($this->outputType === null) {
            if ($this->inputType === false && $this->displayType === false) {
                throw new LogicException('Form property widget requires an "input_type" or a "display_type"');
            }

            $type = null;

            if ($this->inputType === false || is_string($this->displayType)) {
                $type = static::PROPERTY_DISPLAY;
            }

            if ($this->displayType === false || is_string($this->inputType)) {
                $type = static::PROPERTY_CONTROL;
            }

            $this->outputType = $type;
        }

        return $this->outputType;
    }
652722
public static function forOut(): OutputStream
    {
        if (null === self::$out) {
            self::$out = self::create('php://stdout');
        }

        return self::$out;
    }
208807
public function bytesLeft(): int
    {
        if (null === $this->handle || !is_resource($this->handle)) {
            throw new \LogicException('Can not read from closed input stream.');
        }

        $bytesRead = ftell($this->handle);
        if (!is_int($bytesRead)) {
            return 0;
        }

        return $this->getResourceLength() - $bytesRead;
    }