text = (string)$text; $this->arguments = $arguments; } /** * Get phrase base text * * @return string */ public function getText() { return $this->text; } /** * Get phrase message arguments * * @return array */ public function getArguments() { return $this->arguments; } /** * Render phrase * * @return string */ public function render() { try { return self::getRenderer()->render([$this->text], $this->getArguments()); } catch (\Exception $e) { return $this->getText(); } } /** * Defers rendering to the last possible moment (when converted to string) * * @return string */ public function __toString() { return $this->render(); } /** * Specify data which should be serialized to JSON * * @return string */ public function jsonSerialize() { return $this->render(); } }