Completed
Push — master ( 02e9e6...9b3fc3 )
by ARCANEDEV
09:52
created

Locales   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 1
dl 0
loc 43
rs 10
c 0
b 0
f 0
ccs 0
cts 15
cp 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A all() 0 8 1
A keys() 0 4 1
A get() 0 4 1
1
<?php namespace Arcanesoft\Seo\Entities;
2
3
/**
4
 * Class     Locales
5
 *
6
 * @package  Arcanesoft\Seo\Entities
7
 * @author   ARCANEDEV <[email protected]>
8
 */
9
class Locales
10
{
11
    /* -----------------------------------------------------------------
12
     |  Main Methods
13
     | -----------------------------------------------------------------
14
     */
15
    /**
16
     * Get all the supported locales.
17
     *
18
     * @return \Illuminate\Support\Collection
19
     */
20
    public static function all()
21
    {
22
        $locales = config('arcanesoft.seo.locales', []);
23
24
        return collect(array_combine($locales, $locales))->transform(function ($locale) {
25
            return trans("seo::locales.$locale");
26
        });
27
    }
28
29
    /**
30
     * Get all the supported locales keys.
31
     *
32
     * @return \Illuminate\Support\Collection
33
     */
34
    public static function keys()
35
    {
36
        return static::all()->keys();
37
    }
38
39
    /**
40
     * Get a supported locale by its key.
41
     *
42
     * @param  string       $key
43
     * @param  string|null  $default
44
     *
45
     * @return string|null
46
     */
47
    public static function get($key, $default = null)
0 ignored issues
show
Unused Code introduced by
The parameter $default is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
48
    {
49
        return static::all()->get($key);
50
    }
51
}
52