PluginProbe
Independent Analytics – WordPress Analytics Plugin / 2.11.0
Independent Analytics – WordPress Analytics Plugin v2.11.0
2.15.5 2.15.4 2.15.3 2.15.2 2.15.1 2.15.0 2.14.10 trunk 1.1 1.10 1.10.1 1.11 1.12 1.13 1.14 1.15 1.16 1.17 1.17.1 1.17.2 1.17.3 1.17.4 1.18 1.18.1 1.19.0 All 120 releases
independent-analytics / vendor / symfony / translation / TranslatableMessage.php
TranslatableMessage.php
53 lines 1.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11 namespace IAWPSCOPED\Symfony\Component\Translation;
12
13 use IAWPSCOPED\Symfony\Contracts\Translation\TranslatableInterface;
14 use IAWPSCOPED\Symfony\Contracts\Translation\TranslatorInterface;
15 /**
16 * @author Nate Wiebe <nate@northern.co>
17 * @internal
18 */
19 class TranslatableMessage implements TranslatableInterface
20 {
21 private $message;
22 private $parameters;
23 private $domain;
24 public function __construct(string $message, array $parameters = [], ?string $domain = null)
25 {
26 $this->message = $message;
27 $this->parameters = $parameters;
28 $this->domain = $domain;
29 }
30 public function __toString() : string
31 {
32 return $this->getMessage();
33 }
34 public function getMessage() : string
35 {
36 return $this->message;
37 }
38 public function getParameters() : array
39 {
40 return $this->parameters;
41 }
42 public function getDomain() : ?string
43 {
44 return $this->domain;
45 }
46 public function trans(TranslatorInterface $translator, ?string $locale = null) : string
47 {
48 return $translator->trans($this->getMessage(), \array_map(static function ($parameter) use($translator, $locale) {
49 return $parameter instanceof TranslatableInterface ? $parameter->trans($translator, $locale) : $parameter;
50 }, $this->getParameters()), $this->getDomain(), $locale);
51 }
52 }
53