FileManager::init()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 5
ccs 4
cts 4
cp 1
rs 9.4285
cc 1
eloc 3
nc 1
nop 0
crap 1
1
<?php
2
3
/**
4
 * @link https://github.com/rkit/filemanager-yii2
5
 * @copyright Copyright (c) 2015 Igor Romanov
6
 * @license [MIT](http://opensource.org/licenses/MIT)
7
 */
8
9
namespace rkit\filemanager;
10
11
use Yii;
12
use yii\base\Component;
13
14
/**
15
 * Component of FileManager
16
 *
17
 * @author Igor Romanov <[email protected]>
18
 */
19
class FileManager extends Component
20
{
21
    /**
22
     * @var string Session variable name
23
     */
24
    public $sessionName = 'filemanager.uploads';
25
26
    /**
27
     * @internal
28
     */
29 1
    public function init()
30
    {
31 1
        parent::init();
32 1
        $this->registerTranslations();
33 1
    }
34
35
    /**
36
     * Registers translator
37
     * @internal
38
     *
39
     * @return void
40
     */
41 31
    public function registerTranslations()
42
    {
43 31
        if (!isset(\Yii::$app->i18n->translations['filemanager-yii2'])) {
44 1
            \Yii::$app->i18n->translations['filemanager-yii2'] = [
45 1
                'class' => 'yii\i18n\PhpMessageSource',
46 1
                'basePath' => '@vendor/rkit/filemanager-yii2/src/messages',
47 1
                'sourceLanguage' => 'en',
48
            ];
49 1
        }
50 31
    }
51
}
52