Passed
Push — master ( 27c83c...3b806d )
by Loban
03:03
created

Module::initTranslations()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 3
c 0
b 0
f 0
dl 0
loc 5
rs 10
cc 1
nc 1
nop 0
1
<?php
2
/**
3
 * @link https://github.com/lav45/yii2-activity-logger
4
 * @copyright Copyright (c) 2017 LAV45
5
 * @author Aleksey Loban <[email protected]>
6
 * @license http://opensource.org/licenses/BSD-3-Clause
7
 */
8
9
namespace lav45\activityLogger\module;
10
11
use Yii;
12
use yii\i18n\PhpMessageSource;
13
14
class Module extends \yii\base\Module
15
{
16
    /**
17
     * @var array Список моделей которые логировались
18
     * [ entityName => \namespace\to\Model\EntityClass ]
19
     * Эта информация используется для корректного отображения имен полей, записанных данных
20
     * Если `entityName` не будет найдена в списке то имена полей будут выводится без преобразования
21
     * @see Model::getAttributeLabel()
22
     */
23
    public array $entityMap = [];
24
25
    /**
26
     * Initializes the module.
27
     */
28
    public function init()
29
    {
30
        parent::init();
31
32
        $this->initTranslations();
33
    }
34
35
    protected function initTranslations()
36
    {
37
        Yii::$app->i18n->translations['lav45/logger'] = [
38
            '__class' => PhpMessageSource::class,
39
            'basePath' => __DIR__ . '/messages',
40
        ];
41
    }
42
}
43