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

Locales::keys()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
ccs 0
cts 4
cp 0
cc 1
eloc 2
nc 1
nop 0
crap 2
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