- Removing symfony/deprecation-contracts (v2.4.0) - Upgrading ddeboer/imap (1.12.1 => 1.13.1) - Upgrading directorytree/ldaprecord (v2.6.3 => v2.10.1) - Upgrading illuminate/contracts (v8.53.1 => v9.3.0) - Upgrading nesbot/carbon (2.51.1 => 2.57.0) - Upgrading phpmailer/phpmailer (v6.5.0 => v6.6.0) - Upgrading psr/container (1.1.1 => 2.0.2) - Upgrading psr/log (1.1.4 => 3.0.0) - Upgrading psr/simple-cache (1.0.1 => 2.0.0) - Upgrading robthree/twofactorauth (1.8.0 => 1.8.1) - Upgrading symfony/polyfill-ctype (v1.23.0 => v1.24.0) - Upgrading symfony/polyfill-mbstring (v1.23.1 => v1.24.0) - Upgrading symfony/polyfill-php80 (v1.23.1 => v1.24.0) - Upgrading symfony/translation (v5.3.4 => v6.0.5) - Upgrading symfony/translation-contracts (v2.4.0 => v3.0.0) - Upgrading symfony/var-dumper (v5.3.6 => v6.0.5) - Upgrading tightenco/collect (v8.34.0 => v8.83.2) - Upgrading twig/twig (v3.3.2 => v3.3.8)
		
			
				
	
	
		
			63 lines
		
	
	
		
			1.6 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			63 lines
		
	
	
		
			1.6 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
<?php
 | 
						|
 | 
						|
/*
 | 
						|
 * This file is part of the Symfony package.
 | 
						|
 *
 | 
						|
 * (c) Fabien Potencier <fabien@symfony.com>
 | 
						|
 *
 | 
						|
 * For the full copyright and license information, please view the LICENSE
 | 
						|
 * file that was distributed with this source code.
 | 
						|
 */
 | 
						|
 | 
						|
namespace Symfony\Component\Translation;
 | 
						|
 | 
						|
use Symfony\Contracts\Translation\TranslatableInterface;
 | 
						|
use Symfony\Contracts\Translation\TranslatorInterface;
 | 
						|
 | 
						|
/**
 | 
						|
 * @author Nate Wiebe <nate@northern.co>
 | 
						|
 */
 | 
						|
class TranslatableMessage implements TranslatableInterface
 | 
						|
{
 | 
						|
    private string $message;
 | 
						|
    private array $parameters;
 | 
						|
    private ?string $domain;
 | 
						|
 | 
						|
    public function __construct(string $message, array $parameters = [], string $domain = null)
 | 
						|
    {
 | 
						|
        $this->message = $message;
 | 
						|
        $this->parameters = $parameters;
 | 
						|
        $this->domain = $domain;
 | 
						|
    }
 | 
						|
 | 
						|
    public function __toString(): string
 | 
						|
    {
 | 
						|
        return $this->getMessage();
 | 
						|
    }
 | 
						|
 | 
						|
    public function getMessage(): string
 | 
						|
    {
 | 
						|
        return $this->message;
 | 
						|
    }
 | 
						|
 | 
						|
    public function getParameters(): array
 | 
						|
    {
 | 
						|
        return $this->parameters;
 | 
						|
    }
 | 
						|
 | 
						|
    public function getDomain(): ?string
 | 
						|
    {
 | 
						|
        return $this->domain;
 | 
						|
    }
 | 
						|
 | 
						|
    public function trans(TranslatorInterface $translator, string $locale = null): string
 | 
						|
    {
 | 
						|
        return $translator->trans($this->getMessage(), array_map(
 | 
						|
            static function ($parameter) use ($translator, $locale) {
 | 
						|
                return $parameter instanceof TranslatableInterface ? $parameter->trans($translator, $locale) : $parameter;
 | 
						|
            },
 | 
						|
            $this->getParameters()
 | 
						|
        ), $this->getDomain(), $locale);
 | 
						|
    }
 | 
						|
}
 |