langCode = $langCode; $this->format = $format; } public function getLangCode() { return $this->langCode; } /** * Allow the Message class to be mocked in tests by constructing objects in * a protected method. * * @internal * @param MessageSpecifier $spec * @return Message */ protected function createMessage( MessageSpecifier $spec ) { return Message::newFromSpecifier( $spec ); } public function format( MessageSpecifier $mv ): string { $message = $this->createMessage( $mv ); $message->inLanguage( $this->langCode ); return $message->toString( $this->format ); } }