SettingsImporter   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 0
dl 0
loc 28
ccs 9
cts 9
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A settings() 0 4 1
A importSetting() 0 10 2
1
<?php
2
3
namespace League\CLImate\Settings;
4
5
trait SettingsImporter
6
{
7
    /**
8
     * Dictates any settings that a class may need access to
9
     *
10
     * @return array
11
     */
12 488
    public function settings()
13
    {
14 488
        return [];
15
    }
16
17
    /**
18
     * Import the setting into the class
19
     *
20
     * @param \League\CLImate\Settings\SettingsInterface $setting
21
     */
22 44
    public function importSetting($setting)
23
    {
24 44
        $short_name = basename(str_replace('\\', '/', get_class($setting)));
25
26 44
        $method = 'importSetting' . $short_name;
27
28 44
        if (method_exists($this, $method)) {
29 44
            $this->$method($setting);
30 44
        }
31 44
    }
32
}
33