Completed
Push — master ( 21c1bf...8efbb2 )
by Ross
07:30
created

ConfigurationLoader::loadConfigurationRollback()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 6
Ratio 100 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 6
loc 6
rs 9.4285
cc 1
eloc 4
nc 1
nop 0
1
<?php
2
/**
3
 * A two factor authentication module that protects both the admin and customer logins
4
 * Copyright (C) 2017  Ross Mitchell
5
 *
6
 * This file is part of Rossmitchell/Twofactor.
7
 *
8
 * Rossmitchell/Twofactor is free software: you can redistribute it and/or modify
9
 * it under the terms of the GNU General Public License as published by
10
 * the Free Software Foundation, either version 3 of the License, or
11
 * (at your option) any later version.
12
 *
13
 * This program is distributed in the hope that it will be useful,
14
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
 * GNU General Public License for more details.
17
 *
18
 * You should have received a copy of the GNU General Public License
19
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20
 */
21
22
namespace Rossmitchell\Twofactor\Tests\Integration\FixtureLoader\Traits;
23
24 View Code Duplication
trait ConfigurationLoader
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
25
{
26
    public static function getConfigurationData()
27
    {
28
        require __DIR__.'/../_data/configuration.php';
0 ignored issues
show
introduced by
"require" statement detected. File manipulations are discouraged. Concatenating is forbidden.
Loading history...
29
        if (!isset($configurationData)) {
0 ignored issues
show
Bug introduced by
The variable $configurationData seems to never exist, and therefore isset should always return false. Did you maybe rename this variable?

This check looks for calls to isset(...) or empty() on variables that are yet undefined. These calls will always produce the same result and can be removed.

This is most likely caused by the renaming of a variable or the removal of a function/method parameter.

Loading history...
30
            throw new \Exception("No Customer Data has been set");
0 ignored issues
show
introduced by
Direct throw of Exception is discouraged. Use \Magento\Framework\Exception\LocalizedException instead.
Loading history...
31
        }
32
33
        return $configurationData;
34
    }
35
36
    static function loadConfiguration()
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
37
    {
38
        echo "loading Configuration data".PHP_EOL;
0 ignored issues
show
introduced by
Use of echo language construct is discouraged.
Loading history...
39
40
        $action            = 'load';
41
        $configurationData = self::getConfigurationData();
42
        require __DIR__.'/../_loaders/configuration.php';
0 ignored issues
show
introduced by
"require" statement detected. File manipulations are discouraged. Concatenating is forbidden.
Loading history...
43
    }
44
45
    static function loadConfigurationRollback()
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
46
    {
47
        $action            = 'rollback';
48
        $configurationData = self::getConfigurationData();
49
        require __DIR__.'/../_loaders/configuration.php';
0 ignored issues
show
introduced by
"require" statement detected. File manipulations are discouraged. Concatenating is forbidden.
Loading history...
50
    }
51
}
52