LocalizationService   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 5
c 1
b 0
f 0
dl 0
loc 16
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A translate() 0 7 2
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the Extension "fe_change_pwd" for TYPO3 CMS.
7
 *
8
 * For the full copyright and license information, please read the
9
 * LICENSE.txt file that was distributed with this source code.
10
 */
11
12
namespace Derhansen\FeChangePwd\Service;
13
14
use TYPO3\CMS\Extbase\Utility\LocalizationUtility;
15
16
/**
17
 * Class LocalizationService - wrapper class for LocalizationUtility so calls can be mocked in tests
18
 */
19
class LocalizationService
20
{
21
    /**
22
     * Translates the given key with the given argumens
23
     *
24
     * @param string $key
25
     * @param array $arguments
26
     * @return string
27
     */
28
    public function translate(string $key, array $arguments = []): string
29
    {
30
        $result = LocalizationUtility::translate($key, 'FeChangePwd', $arguments);
31
        if (!$result) {
32
            $result = '';
33
        }
34
        return $result;
35
    }
36
}
37