ConfigurationTrait   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 10
dl 0
loc 41
ccs 13
cts 13
cp 1
rs 10
c 1
b 0
f 1
wmc 5

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getConfig() 0 3 1
A hasConfig() 0 3 1
A addConfig() 0 13 3
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