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

Configurable   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 40
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0
wmc 2
lcom 1
cbo 1

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setConfigs() 0 6 1
A getConfig() 0 4 1
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