Test Failed
Push — master ( 73072d...9ac00f )
by graychen
03:06
created

Module::t()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 4
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
namespace graychen\yii2\basic\auth;
3
4
use yii\base\Module as BaseModule;
5
/**
6
 * portal module definition class
7
 */
8
class Module extends BaseModule
9
{
10
    /**
11
     * @inheritdoc
12
     */
13
    public $controllerNamespace = 'graychen/yii2/basic/auth/controllers';
14
    /**
15
     *
16
     * @var string source language for translation
17
     */
18
    public $sourceLanguage = 'en-US';
19
    /**
20
     * @inheritdoc
21
     */
22
    public function init()
23
    {
24
        parent::init();
25
        $this->registerTranslations();
26
    }
27
    /**
28
     * Registers the translation files
29
     */
30
    protected function registerTranslations()
31
    {
32
        Yii::$app->i18n->translations['graychen/yii2/basic/auth/*'] = [
0 ignored issues
show
Bug introduced by
The type graychen\yii2\basic\auth\Yii was not found. Did you mean Yii? If so, make sure to prefix the type with \.
Loading history...
33
            'class' => 'yii\i18n\PhpMessageSource',
34
            'sourceLanguage' => $this->sourceLanguage,
35
            'basePath' => '@graychen/yii2/basic/auth/messages',
36
            'fileMap' => [
37
                'graychen/yii2/basic/auth/app.php' => 'app.php',
38
            ],
39
        ];
40
    }
41
    /**
42
     * Translates a message. This is just a wrapper of Yii::t
43
     *
44
     * @see Yii::t
45
     *
46
     * @param $category
47
     * @param $message
48
     * @param array $params
49
     * @param null $language
0 ignored issues
show
Documentation Bug introduced by
Are you sure the doc-type for parameter $language is correct as it would always require null to be passed?
Loading history...
50
     * @return string
51
     */
52
    public static function t($category, $message, $params = [], $language = null)
53
    {
54
        return Yii::t('graychen/yii2/basic/auth/' . $category, $message, $params, $language);
55
    }
56
}
57