Gets the start line of a message

@param MessageInterface $message

@return string
@throws \InvalidArgumentException
320430
public static function getStartLine(MessageInterface $message)
    {
        if ($message instanceof RequestInterface) {
            return trim($message->getMethod() . ' '
                . $message->getResource())
                . ' HTTP/' . $message->getProtocolVersion();
        } elseif ($message instanceof ResponseInterface) {
            return 'HTTP/' . $message->getProtocolVersion() . ' '
                . $message->getStatusCode() . ' '
                . $message->getReasonPhrase();
        } else {
            throw new \InvalidArgumentException('Unknown message type');
        }
    }
620439
private function dispatch(MessageInterface $message): bool
    {
        $type = $message->getType();

        if (!$this->hasHandlers($type)) {
            return true;
        }

        $result = true;

        foreach ($this->handlers[$type] as $handler) {
            $handlerResult = $this->handleMessage($handler, $message);

            if ($result && !$handlerResult) {
                $result = false;
            }
        }

        return $result;
    }
1099461
public function parse($message)
  {
    //Checking if the message is a full line
    if (strpos($message, "\r\n") === false) {
        return;
    }

    //Parsing the message
    if (!preg_match($this->messageRegex, $message, $parsed)) {
        $parsed = ['invalid' => $message];

        return $parsed;
    }

    /*
    * Raw message
    */
    $parsed['raw'] = $parsed[0];

    $parsed = $this->parseParameters($parsed);

    return $this->removeIntegerKeys($parsed);
  }
1114179
private function getValidationMessage(ErrorInterface $error): string
    {
        $message = $this->getMessageFormatter()
            ->formatMessage($error->getMessageTemplate(), $error->getMessageParameters());

        return $message;
    }
666373
public function beginInfo(string $message, array $context = []) {
        return $this->begin(LogLevel::INFO, $message, $context);
    }
554929
public static function t($message)
    {
        if (!isset(static::$_handlers[static::$_domain])) {
            static::loadHandler('Horde_Translation_Handler_Gettext');
        }
        return static::$_handlers[static::$_domain]->t($message);
    }
891881
public function modify(MessageInterface $message) : MessageInterface
    {
        /** @var MessageModifierInterface $modifier */
        foreach ($this->collection as $modifier) {
            $message = $modifier->modify($message);
        }

        return $message;
    }
292300
public function gettext($message) {
		if (strlen($message) === 0) {
			return $message;
		}
		if ($this->reader === null) {
			return $message;
		}
		return $this->reader->translate((string)$message);
	}
340026
public static function getResource(StreamInterface $stream)
    {
        self::register();

        if ($stream->isReadable()) {
            $mode = $stream->isWritable() ? 'r+' : 'r';
        } elseif ($stream->isWritable()) {
            $mode = 'w';
        } else {
            throw new \InvalidArgumentException('The stream must be readable, '
                .'writable, or both.');
        }

        return fopen('phmessage://stream', $mode, null, stream_context_create([
            'phmessage' => ['stream' => $stream],
        ]));
    }
1353042
public function message(CommitMessageInterface $message)
    {
        foreach ($this->getReviews()->forMessage($message) as $review) {
            $review->review($this->getReporter(), $message);
        }

        return $this;
    }
194707
private function readline($message)
    {
        echo Color::green("$message y/N >>> ");

        $input = strtolower(trim(readline()));

        if (is_null($input) || strlen($input) == 0) {
            $input = 'n';
        }

        if (!in_array($input, ['y', 'n'])) {
            echo Color::red('Invalid choice')."\n";

            return $this->readline($message);
        }

        if (strtolower($input) == "y") {
            return true;
        }

        return false;
    }
569994
public function setMessageId($message)
    {
        if (is_bool($message)) {
            $this->_messageId = $message;
        } else {
            if (!preg_match('/^\<.+@.+\>$/', $message)) {
                throw new InvalidArgumentException('Invalid format to Message-ID. The text should be something like "<uuid@server.com>"');
            }
            $this->_messageId = $message;
        }

        return $this;
    }
657175
public function startConversation($id, $message)
    {
        if ($this->isEmptyId($id)) {
            throw new InvalidArgumentException;
        }

        if (!$message) {
            throw new InvalidArgumentException;
        }

        $params = [
            'body' => $message
        ];

        $res = $this->call('users/' . $id . '/startconversation', $params, 'post');

        if ($res && isset($res['id'])) {
            return true;
        }

        return false;
    }
97037
public static function fromMessage(Message $msg)
    {
        $count = $msg->shift();

        if ($count != $msg->count()) {
            throw new InvalidArgumentException(
                'The action count is not the same as the actual number of actions.');
        }

        return new self($msg->toArray());
    }
1015239
public function setMessage($message)
    {
        $messageVariables = null;

        if (is_array($message)) {
            if (array_key_exists('messageVariables', $message)) {
                $messageVariables = $message['messageVariables'];
            }

            if (array_key_exists('message', $message)) {
                $message = $message['message'];
            } else {
                $messageVariables = $message;
                $message          = $this->messageTemplate;
            }
        }

        if (!is_string($message)) {
            throw new InvalidArgumentException(
                sprintf(
                    'Wrong parameters for %s([array|string $message]); %s given.',
                    __METHOD__,
                    is_object($message) ? get_class($message) : gettype($message)
                ),
                E_ERROR
            );
        }

        $this->message = $this->createMessage($message, $messageVariables);

        return $this;
    }
746667
public function prepareMessage(ErrorInterface $error)
    {
        return sprintf('PHP %s: %s in %s on line %d', $this->mapErrorCode($error), $error->getMessage(), $error->getFile(), $error->getLine());
    }
448437
public static function get ($message1, $message2 = null, $n = null)
	{
		$in = self::getInstance ();
		return $in->getText ($message1, $message2, $n);
	}