LanguageHelper   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 3
dl 0
loc 14
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A getLocales() 0 6 1
1
<?php
2
/**
3
 * @link https://github.com/yiimaker/yii2-banner
4
 * @copyright Copyright (c) 2017 Yii Maker
5
 * @license BSD 3-Clause License
6
 */
7
8
namespace ymaker\banner\backend\helpers;
9
10
use Yii;
11
use motion\i18n\LanguageProviderInterface;
12
13
/**
14
 * Language helper.
15
 *
16
 * @author Vladimir Kuprienko <[email protected]>
17
 * @since 1.0
18
 */
19
class LanguageHelper
20
{
21
    /**
22
     * Returns languages locales list.
23
     *
24
     * @return array
25
     */
26
    public static function getLocales()
27
    {
28
        /* @var LanguageProviderInterface $languageProvider */
29
        $languageProvider = Yii::$container->get(LanguageProviderInterface::class);
30
        return array_column($languageProvider->getLanguages(), 'locale');
31
    }
32
}
33