Completed
Push — master ( cf2e2e...a40fc9 )
by ARCANEDEV
02:34
created

SettingsManager::getConfig()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 7
ccs 0
cts 5
cp 0
rs 9.4286
cc 1
eloc 3
nc 1
nop 2
crap 2
1
<?php namespace Arcanedev\Settings;
2
3
use Illuminate\Support\Manager;
4
5
/**
6
 * Class     SettingsManager
7
 *
8
 * @package  Arcanedev\Settings
9
 * @author   ARCANEDEV <[email protected]>
10
 */
11
class SettingsManager extends Manager
12
{
13
    /* ------------------------------------------------------------------------------------------------
14
     |  Main Functions
15
     | ------------------------------------------------------------------------------------------------
16
     */
17
    /**
18
     * Get the default driver name.
19
     *
20
     * @return string
21
     */
22
    public function getDefaultDriver()
23
    {
24
        return $this->getConfig('settings.default', 'json');
25
    }
26
27
    /* ------------------------------------------------------------------------------------------------
28
     |  Driver Functions
29
     | ------------------------------------------------------------------------------------------------
30
     */
31
    /**
32
     * Create the Json driver store.
33
     *
34
     * @return string
35
     */
36
    public function createJsonDriver()
37
    {
38
        return 'Json driver';
39
    }
40
41
    /**
42
     * Create the Database driver store.
43
     *
44
     * @return string
45
     */
46
    public function createDatabaseDriver()
47
    {
48
        return 'Database driver';
49
    }
50
51
    /**
52
     * Create the Memory driver store.
53
     *
54
     * @return string
55
     */
56
    public function createMemoryDriver()
57
    {
58
        return 'Memory driver';
59
    }
60
61
    /**
62
     * Create the Array driver store.
63
     *
64
     * @return string
65
     */
66
    public function createArrayDriver()
67
    {
68
        return 'Array driver';
69
    }
70
71
    /* ------------------------------------------------------------------------------------------------
72
     |  Other Functions
73
     | ------------------------------------------------------------------------------------------------
74
     */
75
    /**
76
     * Get config.
77
     *
78
     * @param  string      $key
79
     * @param  mixed|null  $default
80
     *
81
     * @return string
82
     */
83
    protected function getConfig($key, $default = null)
84
    {
85
        /** @var  \Illuminate\Config\Repository  $config */
86
        $config = $this->app['config'];
87
88
        return $config->get($key, $default);
89
    }
90
}
91