Cli
2 months ago
Exceptions
2 months ago
Lang
2 months ago
Laravel
2 months ago
List
2 months ago
MessageFormatter
2 months ago
PHPStan
2 months ago
Traits
2 months ago
AbstractTranslator.php
2 months ago
Carbon.php
2 months ago
CarbonConverterInterface.php
2 months ago
CarbonImmutable.php
2 months ago
CarbonInterface.php
2 months ago
CarbonInterval.php
2 months ago
CarbonPeriod.php
2 months ago
CarbonPeriodImmutable.php
2 months ago
CarbonTimeZone.php
2 months ago
Factory.php
2 months ago
FactoryImmutable.php
2 months ago
Language.php
2 months ago
Translator.php
2 months ago
TranslatorImmutable.php
2 months ago
TranslatorStrongTypeInterface.php
2 months ago
TranslatorImmutable.php
82 lines
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * This file is part of the Carbon package. |
| 5 | * |
| 6 | * (c) Brian Nesbitt <brian@nesbot.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 ProfilePressVendor\Carbon; |
| 12 | |
| 13 | use ProfilePressVendor\Carbon\Exceptions\ImmutableException; |
| 14 | use ProfilePressVendor\Symfony\Component\Config\ConfigCacheFactoryInterface; |
| 15 | use ProfilePressVendor\Symfony\Component\Translation\Formatter\MessageFormatterInterface; |
| 16 | class TranslatorImmutable extends Translator |
| 17 | { |
| 18 | /** @var bool */ |
| 19 | private $constructed = \false; |
| 20 | public function __construct($locale, ?MessageFormatterInterface $formatter = null, $cacheDir = null, $debug = \false) |
| 21 | { |
| 22 | parent::__construct($locale, $formatter, $cacheDir, $debug); |
| 23 | $this->constructed = \true; |
| 24 | } |
| 25 | /** |
| 26 | * @codeCoverageIgnore |
| 27 | */ |
| 28 | public function setDirectories(array $directories) |
| 29 | { |
| 30 | $this->disallowMutation(__METHOD__); |
| 31 | return parent::setDirectories($directories); |
| 32 | } |
| 33 | public function setLocale($locale) |
| 34 | { |
| 35 | $this->disallowMutation(__METHOD__); |
| 36 | return parent::setLocale($locale); |
| 37 | } |
| 38 | /** |
| 39 | * @codeCoverageIgnore |
| 40 | */ |
| 41 | public function setMessages($locale, $messages) |
| 42 | { |
| 43 | $this->disallowMutation(__METHOD__); |
| 44 | return parent::setMessages($locale, $messages); |
| 45 | } |
| 46 | /** |
| 47 | * @codeCoverageIgnore |
| 48 | */ |
| 49 | public function setTranslations($messages) |
| 50 | { |
| 51 | $this->disallowMutation(__METHOD__); |
| 52 | return parent::setTranslations($messages); |
| 53 | } |
| 54 | /** |
| 55 | * @codeCoverageIgnore |
| 56 | */ |
| 57 | public function setConfigCacheFactory(ConfigCacheFactoryInterface $configCacheFactory): void |
| 58 | { |
| 59 | $this->disallowMutation(__METHOD__); |
| 60 | parent::setConfigCacheFactory($configCacheFactory); |
| 61 | } |
| 62 | public function resetMessages($locale = null) |
| 63 | { |
| 64 | $this->disallowMutation(__METHOD__); |
| 65 | return parent::resetMessages($locale); |
| 66 | } |
| 67 | /** |
| 68 | * @codeCoverageIgnore |
| 69 | */ |
| 70 | public function setFallbackLocales(array $locales) |
| 71 | { |
| 72 | $this->disallowMutation(__METHOD__); |
| 73 | parent::setFallbackLocales($locales); |
| 74 | } |
| 75 | private function disallowMutation($method) |
| 76 | { |
| 77 | if ($this->constructed) { |
| 78 | throw new ImmutableException($method . ' not allowed on ' . static::class); |
| 79 | } |
| 80 | } |
| 81 | } |
| 82 |