Completed
Push — dependabot/composer/friendsofs... ( 7dda48...3ffef6 )
by
unknown
14:55 queued 03:24
created

MessageFormatter::choiceFormat()   A

Complexity

Conditions 3
Paths 4

Size

Total Lines 14

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 14
rs 9.7998
c 0
b 0
f 0
cc 3
nc 4
nop 4
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the Superdesk Web Publisher Core Bundle.
7
 *
8
 * Copyright 2017 Sourcefabric z.u. and contributors.
9
 *
10
 * For the full copyright and license information, please see the
11
 * AUTHORS and LICENSE files distributed with this source code.
12
 *
13
 * @copyright 2017 Sourcefabric z.ú
14
 * @license http://www.superdesk.org/license
15
 */
16
17
namespace SWP\Bundle\CoreBundle\Translation;
18
19
use function strpos;
20
use function substr;
21
use Symfony\Component\Translation\Formatter\MessageFormatter as BaseMessageFormatter;
22
23
class MessageFormatter extends BaseMessageFormatter
24
{
25
    /**
26
     * {@inheritdoc}
27
     */
28
    public function format($message, $locale, array $parameters = array()): string
29
    {
30
        $position = strpos($locale, '@');
31
        if (false !== $position) {
32
            $locale = substr($locale, 0, $position);
33
        }
34
35
        return parent::format($message, $locale, $parameters);
36
    }
37
}
38