Translator::initInstance()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 0
dl 0
loc 6
ccs 0
cts 5
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * Bluz Framework Component
5
 *
6
 * @copyright Bluz PHP Team
7
 * @link      https://github.com/bluzphp/framework
8
 */
9
10
declare(strict_types=1);
11
12
namespace Bluz\Proxy;
13
14
use Bluz\Common\Exception\ConfigurationException;
15
use Bluz\Translator\Translator as Instance;
16
17
/**
18
 * Proxy to Translator
19
 *
20
 * Example of usage
21
 * <code>
22
 *     use Bluz\Proxy\Translator;
23
 *
24
 *     echo Translator::translate('message id');
25
 * </code>
26
 *
27
 * @package  Bluz\Proxy
28
 * @author   Anton Shevchuk
29
 *
30
 * @method   static Instance getInstance()
31
 *
32
 * @method   static string translate($message, ...$text)
33
 * @see      Instance::translate()
34
 *
35
 * @method   static string translatePlural($singular, $plural, $number, ...$text)
36
 * @see      Instance::translatePlural()
37
 */
38
final class Translator
39
{
40
    use ProxyTrait;
41
42
    /**
43
     * Init instance
44
     *
45
     * @return Instance
46
     * @throws ConfigurationException
47
     */
48
    private static function initInstance(): Instance
0 ignored issues
show
Unused Code introduced by
The method initInstance() is not used, and could be removed.

This check looks for private methods that have been defined, but are not used inside the class.

Loading history...
49
    {
50
        $instance = new Instance();
51
        $instance->setOptions(Config::get('translator'));
52
        $instance->init();
53
        return $instance;
54
    }
55
}
56