GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

AbstractSettingGroup   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 0
Metric Value
wmc 7
lcom 1
cbo 3
dl 0
loc 36
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A disableSave() 0 4 1
B execute() 0 20 6
1
<?php
2
3
namespace Magium\Magento\Actions\Admin\Configuration;
4
5
use Magium\InvalidConfigurationException;
6
7
abstract class AbstractSettingGroup extends SettingModifier
8
{
9
10
    const SETTING_OPTION_YES = 1;
11
    const SETTING_OPTION_NO = 0;
12
13
    protected $section;
14
    protected $settings = [];
15
    protected $disableSave = false;
16
17
    public function disableSave($disableSave = true)
18
    {
19
        $this->disableSave = (bool)$disableSave;
20
    }
21
22
    public function execute()
23
    {
24
        if (!$this->section) {
25
            throw new InvalidConfigurationException('The AbstractSettingGroup needs the protected $section property defined in any child class in the format of "Tab/Section"');
26
        }
27
28
        if (empty($this->settings)) {
29
            throw new InvalidConfigurationException('The AbstractSettingGroup needs the protected $settings property defined in any child class in the format of ["id" => "value"] ala SettingModifier');
30
        }
31
32
        foreach ($this->settings as $setting => $value) {
33
            if ($value !== null) { // Skip items that are null.  May help with test performance
34
                $this->set($this->section . '::' . $setting, $value);
35
            }
36
        }
37
38
        if (!$this->disableSave) {
39
            $this->save->save();
40
        }
41
    }
42
}