Completed
Push — master ( e28c49...c020e9 )
by
unknown
19:48
created

LanguageServiceFactory::create()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
nc 1
nop 1
dl 0
loc 5
rs 10
c 1
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the TYPO3 CMS project.
7
 *
8
 * It is free software; you can redistribute it and/or modify it under
9
 * the terms of the GNU General Public License, either version 2
10
 * of the License, or any later version.
11
 *
12
 * For the full copyright and license information, please read the
13
 * LICENSE.txt file that was distributed with this source code.
14
 *
15
 * The TYPO3 project - inspiring people to share!
16
 */
17
18
namespace TYPO3\CMS\Core\Localization;
19
20
/**
21
 * @internal
22
 */
23
class LanguageServiceFactory
24
{
25
    /**
26
     * @var Locales
27
     */
28
    protected $locales;
29
30
    /**
31
     * @var LocalizationFactory
32
     */
33
    protected $localizationFactory;
34
35
    public function __construct(Locales $locales, LocalizationFactory $localizationFactory)
36
    {
37
        $this->locales = $locales;
38
        $this->localizationFactory = $localizationFactory;
39
    }
40
41
    /**
42
     * Factory method to create a language service object.
43
     *
44
     * @param string $locale the locale (= the TYPO3-internal locale given)
45
     * @return LanguageService
46
     */
47
    public function create(string $locale): LanguageService
48
    {
49
        $obj = new LanguageService($this->locales, $this->localizationFactory);
50
        $obj->init($locale);
51
        return $obj;
52
    }
53
}
54