Completed
Push — master ( d87811...e03510 )
by ARCANEDEV
05:16
created

Seo::setConfig()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 2
crap 1
1
<?php namespace Arcanedev\LaravelSeo;
2
3
/**
4
 * Class     Seo
5
 *
6
 * @package  Arcanedev\LaravelSeo
7
 * @author   ARCANEDEV <[email protected]>
8
 */
9
class Seo
10
{
11
    /* -----------------------------------------------------------------
12
     |  Constants
13
     | -----------------------------------------------------------------
14
     */
15
    const KEY = 'laravel-seo';
16
17
    /* -----------------------------------------------------------------
18
     |  Main Methods
19
     | -----------------------------------------------------------------
20
     */
21
    /**
22
     * Get the seo config.
23
     *
24
     * @param  string|null  $key
25
     * @param  mixed|null   $default
26
     *
27
     * @return mixed
28
     */
29 78
    public static function getConfig($key = null, $default = null)
30
    {
31 78
        $key = self::KEY.(is_null($key) ? '' : '.'.$key);
32
33 78
        return config()->get($key, $default);
34
    }
35
36
    /**
37
     * Set the seo config.
38
     *
39
     * @param  string      $key
40
     * @param  mixed|null  $value
41
     */
42 78
    public static function setConfig($key, $value = null)
43
    {
44 78
        config()->set(self::KEY.'.'.$key, $value);
45 78
    }
46
47
    /**
48
     * Get the seo translation.
49
     *
50
     * @param  string  $key
51
     * @param  array   $replace
52
     * @param  string  $locale
53
     *
54
     * @return string
55
     */
56 15
    public static function getTrans($key = null, $replace = [], $locale = null)
57
    {
58 15
        return trans(self::KEY.'::'.$key, $replace, $locale);
59
    }
60
}
61