Module   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 7
dl 0
loc 25
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A init() 0 4 1
A initTranslations() 0 5 1
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
        $this->initTranslations();
32
    }
33
34
    private function initTranslations(): void
35
    {
36
        Yii::$app->getI18n()->translations['lav45/logger'] = [
37
            '__class' => PhpMessageSource::class,
38
            'basePath' => __DIR__ . '/messages',
39
        ];
40
    }
41
}
42