ConfigurationTrait::hasConfig()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 1
cts 1
cp 1
crap 1
rs 10
c 1
b 0
f 1
1
<?php
2
3
namespace Stevenmaguire\Services\Trello\Traits;
4
5
use Stevenmaguire\Services\Trello\Configuration;
6
7
trait ConfigurationTrait
8
{
9
    /**
10
     * Confirms that a given key exists in configuration settings.
11
     *
12 8
     * @return bool
13
     */
14 8
    public function hasConfig()
15
    {
16
        return forward_static_call_array([Configuration::class, 'has'], func_get_args());
17
    }
18
19
    /**
20
     * Attempts to retrieve a given key from configuration settings. Returns
21
     * default if not set.
22
     *
23 12
     * @return mixed
24
     */
25 12
    public function getConfig()
26
    {
27
        return forward_static_call_array([Configuration::class, 'get'], func_get_args());
28
    }
29
30
    /**
31
     * Updates configuration settings with key value pairs.
32
     *
33 12
     * @return this
34
     */
35 12
    public function addConfig()
36
    {
37 12
        $params = func_get_args();
38 12
39 8
        if (! empty($params)) {
40 4
            if (is_array($params[0])) {
41 4
                forward_static_call_array([Configuration::class, 'setMany'], $params);
42
            } else {
43 6
                forward_static_call_array([Configuration::class, 'set'], $params);
44
            }
45 12
        }
46
47
        return $this;
48 2
    }
49
}
50