This function reads through the whole mbox and returns starting positions of the messages.

@return array(int=>int)
328004
public function listMessages()
    {
        $messages = array();
        fseek( $this->fh, 0 );
        // Skip the first mail as this is the mbox header
        $position = $this->findFirstMessage();
        if ( $position === false )
        {
            return $messages;
        }
        // Continue reading through the rest of the mbox
        do
        {
            $position = $this->findNextMessage();
            if ( $position !== false )
            {
                $messages[] = $position;
            }
        } while ( $position !== false );

        return $messages;
    }
821550
protected function readdmesg()
    {
        if (count($this->_dmesg) === 0) {
            if (CommonFunctions::rfts('/var/log/messages', $buf)) {
                    $blocks = preg_replace("/\s(kernel: MINIX \d+\.\d+\.\d+\.)/", '<BLOCK>$1', $buf);
                    $parts = preg_split("/<BLOCK>/", $blocks, -1, PREG_SPLIT_NO_EMPTY);
                    $this->_dmesg = preg_split("/\n/", $parts[count($parts) - 1], -1, PREG_SPLIT_NO_EMPTY);
            }
        }

        return $this->_dmesg;
    }
18560
public function getMessages()
    {
        $messages = parent::getMessages();

        $options = $this->getOptions();
        foreach ($options as $option) {
            $widget = $this->getEntryWidget($option->value);
            $messages = array_merge($messages, $widget->getMessages());
        }

        return $messages;
    }
992726
public function read()
    {
        $batch = [OP_RECV_MESSAGE => true];
        if ($this->metadata === null) {
            $batch[OP_RECV_INITIAL_METADATA] = true;
        }
        $read_event = $this->call->startBatch($batch);
        if ($this->metadata === null) {
            $this->metadata = $read_event->metadata;
        }

        return $this->_deserializeResponse($read_event->message);
    }
1101433
public function readLines()
    {
        if ($this->getFileObject()->isFile()) {
            if ($this->skipEmptyLines) {
                // skip empty lines
                $lines = file($this->getFileObject()->getPathname(), FILE_SKIP_EMPTY_LINES | FILE_IGNORE_NEW_LINES);
            } else {
                $lines = file($this->getFileObject()->getPathname(), FILE_IGNORE_NEW_LINES);
            }

            if (is_array($lines)) {
                return $lines;
            }
        }
        return array();
    }
486869
public function parseLines()
    {
        $text = [];

        while (($line = $this->nextLine()) !== false) {
            $line = rtrim($line);

            // Skip empty lines
            if ($line == "") {
                $text[] = null;
                continue;
            }

            // Look at start of line to detect valid blocktypes
            $blockTypes = [];
            $marker = $line[0];
            if (isset($this->blockTypes[$marker])) {
                foreach ($this->blockTypes[$marker] as $blockType) {
                    $blockTypes[] = $blockType;
                }
            }

            // Check if line is matching a detected blocktype
            foreach ($blockTypes as $blockType) {
                if ($this->{"block".$blockType}($line)) {
                    continue;
                }
            }
        }

        $text = implode("\n", $this->lines);

        return [
            "text" => $text,
            "frontmatter" => $this->frontmatter,
        ];
    }
1332689
public function message()
    {
        $messages = [];
        foreach($this->values as $key => $value) {
            if ($value->fails()) {
                $messages[$key] = $value->message();
            }
        }
        return $messages;
    }
1188406
public function textMessages()
    {
        $result = [];
        foreach ($this->entries as $entry) {
            foreach ($entry->messages as $entryMessage) {
                if ($entryMessage->isMessage) {
                    if ($entryMessage->message->isText && !$entryMessage->message->isQuickReply) {
                        $result[] = $entryMessage;
                    }
                }
            }
        }
        return collect($result);
    }
951931
public function getAll() {
		if ($this->hasAny()) {
			$messages = $_SESSION[self::SESSION_KEY_FLASH];

			$_SESSION[self::SESSION_KEY_FLASH] = [];

			return $messages;
		}
		else {
			return [];
		}
	}
331467
protected function getReadOnlyOperations()
    {
        return array(
            'EXISTS' => true,
            'TYPE' => true,
            'KEYS' => true,
            'SCAN' => true,
            'RANDOMKEY' => true,
            'TTL' => true,
            'GET' => true,
            'MGET' => true,
            'SUBSTR' => true,
            'STRLEN' => true,
            'GETRANGE' => true,
            'GETBIT' => true,
            'LLEN' => true,
            'LRANGE' => true,
            'LINDEX' => true,
            'SCARD' => true,
            'SISMEMBER' => true,
            'SINTER' => true,
            'SUNION' => true,
            'SDIFF' => true,
            'SMEMBERS' => true,
            'SSCAN' => true,
            'SRANDMEMBER' => true,
            'ZRANGE' => true,
            'ZREVRANGE' => true,
            'ZRANGEBYSCORE' => true,
            'ZREVRANGEBYSCORE' => true,
            'ZCARD' => true,
            'ZSCORE' => true,
            'ZCOUNT' => true,
            'ZRANK' => true,
            'ZREVRANK' => true,
            'ZSCAN' => true,
            'ZLEXCOUNT' => true,
            'ZRANGEBYLEX' => true,
            'ZREVRANGEBYLEX' => true,
            'HGET' => true,
            'HMGET' => true,
            'HEXISTS' => true,
            'HLEN' => true,
            'HKEYS' => true,
            'HVALS' => true,
            'HGETALL' => true,
            'HSCAN' => true,
            'HSTRLEN' => true,
            'PING' => true,
            'AUTH' => true,
            'SELECT' => true,
            'ECHO' => true,
            'QUIT' => true,
            'OBJECT' => true,
            'BITCOUNT' => true,
            'BITPOS' => true,
            'TIME' => true,
            'PFCOUNT' => true,
            'SORT' => array($this, 'isSortReadOnly'),
            'BITFIELD' => array($this, 'isBitfieldReadOnly'),
            'GEOHASH' => true,
            'GEOPOS' => true,
            'GEODIST' => true,
            'GEORADIUS' => array($this, 'isGeoradiusReadOnly'),
            'GEORADIUSBYMEMBER' => array($this, 'isGeoradiusReadOnly'),
        );
    }
693785
protected function readMessages()
    {
        $len = $this->readHeader('v', 2);
        $instructions = rtrim($this->readHeaderRaw($len), "\0");
        $len = $this->readHeader('v', 2);
        $hints = rtrim($this->readHeaderRaw($len), "\0");
        $len = $this->readHeader('v', 2);
        $victory = rtrim($this->readHeaderRaw($len), "\0");
        $len = $this->readHeader('v', 2);
        $loss = rtrim($this->readHeaderRaw($len), "\0");
        $len = $this->readHeader('v', 2);
        $history = rtrim($this->readHeaderRaw($len), "\0");
        $len = $this->readHeader('v', 2);
        $scouts = rtrim($this->readHeaderRaw($len), "\0");
        return (object) [
            'instructions' => $instructions,
            'hints' => $hints,
            'victory' => $victory,
            'loss' => $loss,
            'history' => $history,
            'scouts' => $scouts,
        ];
    }
784242
public function getMessages()
    {
        $message = new IncomingMessage(Location::PATTERN, $this->event->get('ToUserName'), $this->event->get('FromUserName'),
            $this->event);
        $message->setLocation($this->getLocation());

        return [$message];
    }
429888
public function getMessages()
    {
        $results  = $this->getResults();
        $messages = [];

        foreach ($results as $result) {
            /** @noinspection SlowArrayOperationsInLoopInspection */
            $messages = array_replace_recursive($messages, $result->getMessages());
        }

        return $messages;
    }
258345
protected function checkPresence()
    {
        $messages = [];

        $result = collect($this->getFiles())
            ->map(function ($files, $type) use (&$messages) {
                $isGood = true;

                $files = collect($files);

                foreach ($files as $file) {
                    if (! is_null($file)) {
                        foreach ($this->getCheckers($type) as $checker) {
                            if (is_string($message = $checker($file))) {
                                $messages[] = $message;
                                $isGood = false;
                            }
                        }
                    }
                }

                return $isGood;
            })
            ->filter(function ($value) {
                return $value === false;
            });

        return [$messages, $result];
    }
1260036
public function getErrorMessages() {
        $messages = array();
        
        foreach($this->entries as $entry) {
            if($entry->isError()) {
                $messages[] = $entry->getMessage();
            }
        }
        
        return $messages;
    }
407709
public function getStdOutAsArray() : array
    {
        if (null === $this->buffer) {
            $this->buffer = $this->textToBuffer();
        }
        return $this->buffer;
    }
1341070
public function getMessages()
    {
        if (empty($this->messages)) {
            $this->messages = [
                new IncomingMessage($this->event->get('text'), $this->event->get('msisdn'), $this->event->get('to'), $this->payload),
            ];
        }

        return $this->messages;
    }