22declare(strict_types=1);
24namespace pocketmine\lang;
28 protected array $params = [];
34 protected string $text,
37 foreach($params as $k => $param){
39 $this->params[$k] = (string) $param;
41 $this->params[$k] = $param;
46 public function getText() : string{
57 public function getParameter(
int|
string $i) :
Translatable|string|null{
58 return $this->params[$i] ?? null;
61 public function format(
string $before,
string $after) : self{
62 return new self(
"$before%$this->text$after", $this->params);
65 public function prefix(
string $prefix) : self{
66 return new self(
"$prefix%$this->text", $this->params);
69 public function postfix(
string $postfix) : self{
70 return new self(
"%$this->text" . $postfix);
__construct(protected string $text, array $params=[])