Completed
Push — master ( d3e41b...65e194 )
by ARCANEDEV
15s queued 11s
created

Configurable::getConfig()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 2
dl 0
loc 4
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Arcanedev\SeoHelper\Traits;
6
7
use Illuminate\Support\Arr;
8
9
/**
10
 * Trait     Configurable
11
 *
12
 * @package  Arcanedev\SeoHelper\Traits
13
 * @author   ARCANEDEV <[email protected]>
14
 */
15
trait Configurable
16
{
17
    /* -----------------------------------------------------------------
18
     |  Properties
19
     | -----------------------------------------------------------------
20
     */
21
22
    /** @var array */
23
    protected $configs = [];
24
25
    /* -----------------------------------------------------------------
26
     |  Getters & Setters
27
     | -----------------------------------------------------------------
28
     */
29
30
    /**
31
     * Set the configs.
32
     *
33
     * @param  array  $configs
34
     *
35
     * @return $this
36
     */
37 798
    protected function setConfigs(array $configs)
38
    {
39 798
        $this->configs = $configs;
40
41 798
        return $this;
42
    }
43
44
    /**
45
     * @param  string      $name
46
     * @param  mixed|null  $default
47
     *
48
     * @return mixed
49
     */
50 768
    public function getConfig($name, $default = null)
51
    {
52 768
        return Arr::get($this->configs, $name, $default);
53
    }
54
}
55