Completed
Push — master ( 8f6f83...74e37f )
by Andrii
02:08
created

src/widgets/LanguageMenu.php (1 issue)

Labels
Severity

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
/*
4
 * Yii2 module for language switching
5
 *
6
 * @link      https://github.com/hiqdev/yii2-language
7
 * @package   yii2-language
8
 * @license   BSD-3-Clause
9
 * @copyright Copyright (c) 2016, HiQDev (http://hiqdev.com/)
10
 */
11
12
namespace hiqdev\yii2\language\widgets;
13
14
use Yii;
15
16
/**
17
 * Language Menu widget.
18
 *
19
 * @property Module $module The module to be used, can be found by default.
20
 */
21
class LanguageMenu extends \yii\base\Widget
22
{
23
    use \hiqdev\yii2\language\GetModuleTrait;
24
25
    public function getLanguages()
26
    {
27
        return $this->getModule()->languages;
0 ignored issues
show
The property languages does not seem to exist. Did you mean _languages?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
28
    }
29
30
    public function getLanguage()
31
    {
32
        return Yii::$app->language;
33
    }
34
35
    public function run()
36
    {
37
        return $this->render('LanguageMenu', [
38
            'language'  => $this->getLanguage(),
39
            'languages' => $this->getLanguages(),
40
            'selectUrl' => '/' . $this->getModule()->id . '/language/select',
41
        ]);
42
    }
43
}
44