Get all MessageThreads with the User.

@return array Array of Api\MessageThread.
499535
public function messageThreads() : array
    {
        $returnThreads = [];

        $threads = $this->get(MessageThread::MESSAGE_THREAD_ENDPOINT . 'users/me/threadIds', [
            'withOnlineIds' => $this->onlineId()
        ]);

        if (empty($threads->threadIds)) return [];

        foreach ($threads->threadIds as $thread) {
            $returnThreads[] = new MessageThread($this->client, $thread->threadId);
        }

        return $returnThreads;
    }
810735
public function getUsers() {
    $tmp = array();
    foreach ($this->htpwd as $key => $line) {
      if(empty($line) || !strpos($line,':')) continue;
      array_push($tmp,explode(":",$line)[0]);
    }
    return $tmp;
  }
1051746
protected function _getAllIndices()
    {
        $out = array();

        foreach ($this->_thread as $val) {
            $out += $val;
        }

        return array_keys($out);
    }
684987
public function toArray()
    {
        $messages = [];
        foreach ($this->messages as $message) {
            $messages[] = $message->raw();
        }

        $previousMessages = $this->handler->getPreviousMessages();

        if (is_array($previousMessages)) {
            return array_merge($previousMessages, $messages);
        }

        return $messages;
    }
1249744
public function getMessages()
    {
        if (empty($this->messages)) {
            $message = $this->event->get('message');
            $userId = $this->event->get('userId');
            $sender = $this->event->get('sender', $userId);

            $incomingMessage = new IncomingMessage($message, $sender, $userId, $this->payload);

            $incomingMessage = $this->addAttachments($incomingMessage);

            $this->messages = [$incomingMessage];
        }

        return $this->messages;
    }
825936
public function getMessages()
    {
        $message = new IncomingMessage(Image::PATTERN, $this->event->get('ToUserName'), $this->event->get('FromUserName'),
            $this->event);
        $message->setImages($this->getImages());

        return [$message];
    }
793675
public function getMessages()
    {
        $message = new IncomingMessage(File::PATTERN, $this->event->get('from')['id'], $this->event->get('conversation')['id'],
            $this->payload);
        $message->setFiles($this->getAttachmentUrls());

        return [$message];
    }
344213
public function messages()
    {
        $messages = [];
        $instances = $this->parents(true);
        foreach ($instances as $instance) {
            $messages[] = $instance->message();
        }
        return $messages;
    }
378187
protected function getUserMessages()
    {
        $messages = [];

        foreach ($this->repository->all() as $field) {
            foreach ($field->getOption('messages') as $rule => $message) {
                $messages[$field->getName().'.'.$rule] = $message;
            }
        }

        return $messages;
    }
599846
public function getAllThreadIdsForUser($uid) {
    $query = 'SELECT DISTINCT(thread.id), MAX(thread.updated) ' .
      'FROM {private_message_threads} AS thread ' .
      'JOIN {private_message_thread__members} AS member ' .
      'ON member.entity_id = thread.id AND member.members_target_id = :uid ' .
      'JOIN {private_message_thread__private_messages} AS thread_messages ' .
      'ON thread_messages.entity_id = thread.id ' .
      'JOIN {private_messages} AS messages ' .
      'ON messages.id = thread_messages.private_messages_target_id ' .
      'JOIN {private_message_thread__last_delete_time} AS thread_delete_time ' .
      'ON thread_delete_time.entity_id = thread.id ' .
      'JOIN {pm_thread_delete_time} as owner_delete_time ' .
      'ON owner_delete_time.id = thread_delete_time.last_delete_time_target_id AND owner_delete_time.owner = :uid ' .
      'WHERE owner_delete_time.delete_time <= messages.created ';
    $vars = [':uid' => $uid];

    $query .= 'GROUP BY thread.id ORDER BY MAX(thread.updated) DESC, thread.id';

    $thread_ids = $this->database->query(
      $query,
      $vars
    )->fetchCol();

    return is_array($thread_ids) ? $thread_ids : [];
  }
65219
public function postbackMessages()
    {
        $result = [];
        foreach ($this->entries as $entry) {
            foreach ($entry->messages as $entryMessage) {
                if ($entryMessage->isPostback) {
                    $result[] = $entryMessage;
                }
            }
        }
        return collect($result);
    }
880938
public function getTotalMessages()
    {
        $sql = 'SELECT COUNT(message_id) FROM ' . $this->messageTable . ' WHERE 1';
        $stmt = $this->getDb()->prepare($sql);
        $stmt->execute();
        return $stmt->fetchColumn();
    }
1245693
public function getMessages()
    {
        $messages = parent::getMessages();
        if ($this->tile !== null) {
            $messages = array_merge($messages, $this->tile->getMessages());
        }

        return $messages;
    }
1146772
public function viewThread(int $id): array
    {
        return $this->getApi()->request($this->getApi()->sprintf('/notifications/threads/:id', (string)$id));
    }
355101
public function getExceptionMessages()
    {
        $messages = array();
        foreach( $this->__get('exceptionsFlat') as $exception ) {
            $messages[] = $exception->getMessage();
        }
        return $messages;
    }
715805
public function threadsWithNewMessages()
    {
        $threadsWithNewMessages = [];
        $participants = Participant::where('user_id', $this->id)->lists('last_read', 'thread_id');

        /**
         * @todo: see if we can fix this more in the future.
         * Illuminate\Foundation is not available through composer, only in laravel/framework which
         * I don't want to include as a dependency for this package...it's overkill. So let's
         * exclude this check in the testing environment.
         */
        if (getenv('APP_ENV') == 'testing' || !str_contains(\Illuminate\Foundation\Application::VERSION, '5.0')) {
            $participants = $participants->all();
        }

        if ($participants) {
            $threads = Thread::whereIn('id', array_keys($participants))->get();

            foreach ($threads as $thread) {
                if ($thread->updated_at > $participants[$thread->id]) {
                    $threadsWithNewMessages[] = $thread->id;
                }
            }
        }

        return $threadsWithNewMessages;
    }
250629
public function markThreadAsRead(int $id): array
    {
        return $this->getApi()->request($this->getApi()->sprintf('/notifications/threads/:id', (string)$id),
            Request::METHOD_PATCH);
    }