Retrieve a message

@param mixed $type The type of the messages to retrieve.
@param string $id The ID of the message
@return null|Message|\Wave\Framework\Flash\Message[]
490720
public function getMessage($type, $id = null)
    {
        $result = null;
        if (null === $id) {
            if (array_key_exists($type, $this->messages)) {
                $result = $this->messages[$type];

                if (!$this->persistMessages) {
                    unset($this->messages[$type]);
                }
            }
        }

        if (null !== $id) {
            if (array_key_exists($type, $this->messages)) {
                if (array_key_exists($id, $this->messages[$type])) {
                    $result = $this->messages[$type][$id];
                    if (!$this->persistMessages) {
                        unset($this->messages[$type][$id]);
                    }
                }
            }
        }

        return $result;
    }
669977
public function getMessageInformation($id = '')
    {
        $message = [];
        if (is_array($this->messages) == true) {
            foreach($this ->messages as $msg) {
                if ($msg['index'] == $id) {
                    return $msg;
                }
            }
        }
        return $message;
    }
1036400
public function getEntityPath($type, $id)
    {
        // Allow other modules to interact
        $event = new EntityGetPathEvent($type, $id);
        $this->eventDispatcher->dispatch(EntityGetPathEvent::EVENT_GET_PATH, $event);
        if ($path = $event->getPath()) {
            return $path;
        }

        // In most cases, this will be used for nodes only, so just set the
        // node URL.
        // It will avoid nasty bugs, since the 'text' core module does sanitize
        // (and call check_markup()) during field load if there are any circular
        // links dependencies between two nodes, it triggers an finite loop.
        // This will also make the whole faster.
        // @todo If node does not exists, no error will be triggered.
        if ('node' === $type) {
            return 'node/' . $id;
        }

        $entity = $this->entityManager->getStorage($type)->load($id);
        if (!$entity) {
            throw new \InvalidArgumentException(sprintf("entity of type %s with identifier %s does not exist", $type, $id));
        }

        if (!$entity instanceof EntityInterface) {
            return $this->getDrupalEntityPath($type, $entity);
        } else {
            return $entity->url();
        }
    }
3440
public function getMessage($id = '')
    {
        $message = [];
        if (is_array($this->messages) == true) {
            foreach($this ->messages as $msg) {
                if ($msg['index'] == $id) {
                    $message = $msg;
                    break;
                }
            }
        }

        if (is_array($message) === true) {
            // Get the message body but do not mark as read
            $message['body'] = quoted_printable_decode(imap_fetchbody($this->conn, $message['index'], FT_PEEK));
        }

        return $message;
    }
923016
public static function get($type = null) {
        return is_null($type) ? self::$_messages : (isset(self::$_messages[$type]) ? self::$_messages[$type] : []);
    }
457027
public function getMessage($id)
    {
        $header = $this->_protocol->top($id);
        $message = $this->_protocol->retrieve($id);

        return new Message($header, $message, $id);
    }
991791
private function _getUrl($type = 'base', $id = 'null') {
		$modelClass = $this->modelClass;
		$collection = $modelClass::getResourceName();

		switch($type) {
			case 'api':
				return $this->_trailingSlash($modelClass::getApiUrl());
				break;
			case 'collection':
				return $this->_trailingSlash($collection, false);
				break;
			case 'element':
				return $this->_trailingSlash($collection) . $this->_trailingSlash($id, false);
				break;
		}

		return '';
	}
464783
public function getDirectMessagesById($id)
	{
		// Check the rate limit for remaining hits
		$this->checkRateLimit('direct_messages', 'show');

		// Set the API path
		$path = '/direct_messages/show.json';

		$data['id'] = $id;

		// Send the request.
		return $this->sendRequest($path, 'GET', $data);
	}
108164
public function getFrames($id, $type)
    {
        $dom = $this->browser->getDom('/'.$type.'/'.$type.'_photos.php?id='.$id);
        if (!$dom) {
            return [];
        }
        $images = (new \DOMXPath($dom))->query('//table//table//table//img');
        $frames = [];
        foreach ($images as $image) {
            $src = $this->getAttrAsArray($image)['src'];
            $entity = new Image();
            if ($type == self::ITEM_TYPE_ANIMATION) {
                $src = str_replace('optimize_b', 'optimize_d', $src);
                if (strpos($src, 'http://') === false) {
                    $src = $this->browser->getHost().'/'.$type.'/'.$src;
                }
                if (preg_match('/\-(?<image>\d+)\-optimize_d(?<ext>\.jpe?g|png|gif)/', $src, $mat)) {
                    $entity->setSource(self::NAME.'/'.$id.'/'.$mat['image'].$mat['ext']);
                    if ($this->uploadImage($src, $entity)) {
                        $frames[] = $entity;
                    }
                }
            } elseif (preg_match('/_(?<round>\d+)\/.+\/(?<id>\d+)-(?<image>\d+)-.+(?<ext>\.jpe?g|png|gif)/', $src, $mat)) {
                $src = $this->browser->getHost().'/'.$type.'/img/'.$mat['round'].'/'.$mat['id'].'/'.$mat['image'].$mat['ext'];
                $entity->setSource(self::NAME.'/'.$id.'/'.$mat['image'].$mat['ext']);
                if ($this->uploadImage($src, $entity)) {
                    $frames[] = $entity;
                }
            }
        }

        return $frames;
    }
541800
public function smtpGetEmailInfoById($id)
    {
        if (empty($id)) {
            return $this->handleError('Empty id');
        }

        $requestResult = $this->sendRequest('/smtp/emails/' . $id);

        return $this->handleResult($requestResult);
    }
236995
public function requestSummaryResponseFor( $id, $type ) {

		$this->httpRequest->setOption( CURLOPT_RETURNTRANSFER, true ); // put result into variable
		$this->httpRequest->setOption( CURLOPT_FAILONERROR, true );

		$this->httpRequest->setOption( CURLOPT_URL, self::SUMMARY_URL );
		$this->httpRequest->setOption( CURLOPT_SSL_VERIFYPEER, false );

		$this->httpRequest->setOption( CURLOPT_HTTPHEADER, array(
			'Accept: application/sparql-results+json, application/rdf+json, application/json',
			'Content-Type: application/x-www-form-urlencoded;charset=UTF-8'
		) );

		$this->httpRequest->setOption( CURLOPT_POST, true );

		$this->httpRequest->setOption(
			CURLOPT_POSTFIELDS,
			"db={$type}&retmode=json&id=" . $id
		);

		return $this->httpRequest->execute();
	}
253236
public function problem($id, $type = 'id')
    {
        $problem = $this->load('p', array($type, $id));

        return Helper\formatProblem($problem);
    }
228376
public function get(string $id_option = null, string $type = 'page', bool $force = false): ?array
  {
    /*
    if ( $all = $this->get_all($id_option, $type) ){
      $r = [];
      foreach ( $all as $a ){
        if ( $this->has($a['id'], '', $force) ){
          $r[] = $a;
        }
      }
      return $r;
    }
    */
    if (
      ($id_option = $this->_get_id_option($id_option, $type)) &&
      $this->has($id_option, $type, $force)
    ){
      return $this->pref->option($id_option);
    }
    return null;
  }
914901
public function getMessage($id)
    {
        $bodyLines = 0;
        $message = $this->_protocol->top($id, $bodyLines, true);

        return new $this->_messageClass(array('handler' => $this, 'id' => $id, 'headers' => $message,
                                              'noToplines' => $bodyLines < 1));
    }
1309480
public function encode($id, $type = '')
    {
        if (!isset($this->_keys[$type])) {
            if ($this->_key === null) {
                $this->_key = $this->crypt->getDerivedKey('secint');
            }

            $this->_keys[$type] = md5($this->_key . $type, true);
        }

        while (true) {
            $rand = mt_rand() & 0xFFFF0000;
            $r = base64_encode(mcrypt_encrypt(MCRYPT_XTEA, $this->_keys[$type], pack('VV', $id, $rand), MCRYPT_MODE_ECB));
            if (strcspn($r, '+/') === 12) {
                return substr($r, 0, -1);
            }
        }

        return $id;
    }
418962
public function getMessage($id)
    {
        $bodyLines = 0;
        $header = $this->_protocol->top($id, $bodyLines, true);
        $message = $message = $this->getRawContent($id);
        return new Message($header, $message, $id);
    }
1110362
public function get_all(string $id_option = null, string $type = 'page'): ?array
  {
    if ( $id_option = $this->_get_id_option($id_option, $type) ){
      return $this->pref->options($id_option ?: $this->get_current());
    }
    return null;
  }