Exceptions
3 years ago
Lang
3 years ago
List
3 years ago
Traits
3 years ago
AbstractTranslator.php
3 years ago
Carbon.php
4 years ago
CarbonConverterInterface.php
4 years ago
CarbonImmutable.php
4 years ago
CarbonInterface.php
3 years ago
CarbonInterval.php
3 years ago
CarbonPeriod.php
3 years ago
CarbonTimeZone.php
3 years ago
Factory.php
4 years ago
FactoryImmutable.php
4 years ago
Language.php
4 years ago
Translator.php
4 years ago
TranslatorImmutable.php
4 years ago
TranslatorStrongTypeInterface.php
4 years ago
index.php
3 years ago
TranslatorImmutable.php
57 lines
| 1 | <?php |
| 2 | namespace MailPoetVendor\Carbon; |
| 3 | if (!defined('ABSPATH')) exit; |
| 4 | use MailPoetVendor\Carbon\Exceptions\ImmutableException; |
| 5 | use MailPoetVendor\Symfony\Component\Config\ConfigCacheFactoryInterface; |
| 6 | use MailPoetVendor\Symfony\Component\Translation\Formatter\MessageFormatterInterface; |
| 7 | class TranslatorImmutable extends Translator |
| 8 | { |
| 9 | private $constructed = \false; |
| 10 | public function __construct($locale, MessageFormatterInterface $formatter = null, $cacheDir = null, $debug = \false) |
| 11 | { |
| 12 | parent::__construct($locale, $formatter, $cacheDir, $debug); |
| 13 | $this->constructed = \true; |
| 14 | } |
| 15 | public function setDirectories(array $directories) |
| 16 | { |
| 17 | $this->disallowMutation(__METHOD__); |
| 18 | return parent::setDirectories($directories); |
| 19 | } |
| 20 | public function setLocale($locale) |
| 21 | { |
| 22 | $this->disallowMutation(__METHOD__); |
| 23 | return parent::setLocale($locale); |
| 24 | } |
| 25 | public function setMessages($locale, $messages) |
| 26 | { |
| 27 | $this->disallowMutation(__METHOD__); |
| 28 | return parent::setMessages($locale, $messages); |
| 29 | } |
| 30 | public function setTranslations($messages) |
| 31 | { |
| 32 | $this->disallowMutation(__METHOD__); |
| 33 | return parent::setTranslations($messages); |
| 34 | } |
| 35 | public function setConfigCacheFactory(ConfigCacheFactoryInterface $configCacheFactory) |
| 36 | { |
| 37 | $this->disallowMutation(__METHOD__); |
| 38 | parent::setConfigCacheFactory($configCacheFactory); |
| 39 | } |
| 40 | public function resetMessages($locale = null) |
| 41 | { |
| 42 | $this->disallowMutation(__METHOD__); |
| 43 | return parent::resetMessages($locale); |
| 44 | } |
| 45 | public function setFallbackLocales(array $locales) |
| 46 | { |
| 47 | $this->disallowMutation(__METHOD__); |
| 48 | parent::setFallbackLocales($locales); |
| 49 | } |
| 50 | private function disallowMutation($method) |
| 51 | { |
| 52 | if ($this->constructed) { |
| 53 | throw new ImmutableException($method . ' not allowed on ' . static::class); |
| 54 | } |
| 55 | } |
| 56 | } |
| 57 |