Completed
Push — master ( 56bf17...6fe368 )
by Antonio Carlos
06:48
created

Config::config()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 11

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2.032

Importance

Changes 0
Metric Value
dl 0
loc 11
ccs 4
cts 5
cp 0.8
rs 9.9
c 0
b 0
f 0
cc 2
nc 2
nop 2
crap 2.032
1
<?php
2
3
namespace PragmaRX\Google2FALaravel\Support;
4
5
trait Config
6
{
7
    /**
8
     * Get a config value.
9
     *
10
     * @param $string
11
     *
12
     * @throws \Exception
13
     *
14
     * @return mixed
15
     */
16 9
    protected function config($string, $default = null)
17
    {
18 9
        if (is_null(config($config = Constants::CONFIG_PACKAGE_NAME))) {
19
            throw new \Exception("Config ({$config}.php) not found. Have you published it?");
20
        }
21
22 9
        return config(
23 9
            implode('.', [Constants::CONFIG_PACKAGE_NAME, $string]),
24
            $default
25
        );
26
    }
27
}
28