Completed
Push — dependabot/composer/phpunit/ph... ( 5f27b0...220ad7 )
by
unknown
03:47 queued 02:04
created

Language   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 1
dl 0
loc 39
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A __toString() 0 4 1
A getName() 0 4 1
A getLocale() 0 4 1
A getWeight() 0 4 1
1
<?php
2
/*
3
 * Copyright (c) Arnaud Ligny <[email protected]>
4
 *
5
 * For the full copyright and license information, please view the LICENSE
6
 * file that was distributed with this source code.
7
 */
8
9
namespace Cecil\Renderer;
10
11
use Cecil\Config;
12
13
/**
14
 * Class Language.
15
 */
16
class Language
17
{
18
    /**
19
     * Config.
20
     *
21
     * @var Config
22
     */
23
    protected $config;
24
25
    /**
26
     * Language constructor.
27
     *
28
     * @param Config
29
     */
30
    public function __construct($config)
31
    {
32
        $this->config = $config;
33
    }
34
35
    public function __toString()
36
    {
37
        return $this->config->getLanguageDefaultKey();
38
    }
39
40
    public function getName()
41
    {
42
        return $this->config->getLanguageProperty('name');
43
    }
44
45
    public function getLocale()
46
    {
47
        return $this->config->getLanguageProperty('locale');
48
    }
49
50
    public function getWeight()
51
    {
52
        return array_search($this->config->getLanguageDefaultKey(), array_keys($this->config->get('languages')));
53
    }
54
}
55