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::disableSave()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
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
}