Subversion-Projekte lars-tiefland.laravel_shop

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
148 lars 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
 
12
namespace Carbon\MessageFormatter;
13
 
14
use ReflectionMethod;
15
use Symfony\Component\Translation\Formatter\MessageFormatter;
16
use Symfony\Component\Translation\Formatter\MessageFormatterInterface;
17
 
18
$transMethod = new ReflectionMethod(MessageFormatterInterface::class, 'format');
19
 
20
require $transMethod->getParameters()[0]->hasType()
21
    ? __DIR__.'/../../../lazy/Carbon/MessageFormatter/MessageFormatterMapperStrongType.php'
22
    : __DIR__.'/../../../lazy/Carbon/MessageFormatter/MessageFormatterMapperWeakType.php';
23
 
24
final class MessageFormatterMapper extends LazyMessageFormatter
25
{
26
    /**
27
     * Wrapped formatter.
28
     *
29
     * @var MessageFormatterInterface
30
     */
31
    protected $formatter;
32
 
33
    public function __construct(?MessageFormatterInterface $formatter = null)
34
    {
35
        $this->formatter = $formatter ?? new MessageFormatter();
36
    }
37
 
38
    protected function transformLocale(?string $locale): ?string
39
    {
40
        return $locale ? preg_replace('/[_@][A-Za-z][a-z]{2,}/', '', $locale) : $locale;
41
    }
42
}