FileManager   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
c 1
b 0
f 0
lcom 0
cbo 2
dl 0
loc 33
ccs 12
cts 12
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A init() 0 5 1
A registerTranslations() 0 10 2
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