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.
Completed
Pull Request — master (#90)
by Kevin
07:48
created

RemoveTermsAndConditions::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 14
Code Lines 11

Duplication

Lines 14
Ratio 100 %

Importance

Changes 0
Metric Value
dl 14
loc 14
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 11
nc 1
nop 5
1
<?php
2
3
namespace Magium\Magento\Actions\Admin\Tables;
4
5
use Magium\Actions\OptionallyConfigurableActionInterface;
6
use Magium\Magento\Actions\Admin\Widget\ClickActionButton;
7
use Magium\Magento\Navigators\Admin\AdminMenu;
8
use Magium\Magento\Themes\Admin\ThemeConfiguration;
9
use Magium\Util\Translator\Translator;
10
use Magium\WebDriver\WebDriver;
11
12
class RemoveTermsAndConditions implements OptionallyConfigurableActionInterface
13
{
14
15
    const ACTION = 'Admin\Tables\RemoveTermsAndConditions';
16
17
    protected $webDriver;
18
    protected $themeConfiguration;
19
    protected $navigator;
20
    protected $clickActionButton;
21
    protected $translator;
22
23 View Code Duplication
    public function __construct(
0 ignored issues
show
Duplication introduced by
This method 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...
24
            WebDriver $webDriver,
25
            ThemeConfiguration $themeConfiguration,
26
            AdminMenu $navigator,
27
            ClickActionButton $clickActionButton,
28
            Translator $translator
29
        )
30
    {
31
        $this->webDriver = $webDriver;
32
        $this->themeConfiguration = $themeConfiguration;
33
        $this->navigator = $navigator;
34
        $this->clickActionButton = $clickActionButton;
35
        $this->translator = $translator;
36
    }
37
38
    public function removeAll($navigate = false)
39
    {
40
        if ($navigate) {
41
            $this->navigator->navigateTo('Sales/Terms and conditions');
42
        }
43
44
        $xpath = $this->themeConfiguration->getFirstTermsRowXpath();
45
46
        while ($this->webDriver->elementExists($xpath, WebDriver::BY_XPATH)) {
47
            $this->webDriver->byXpath($xpath)->click();
48
            $this->clickActionButton->click($this->translator->translate('Delete Condition'));
49
            $this->webDriver->switchTo()->alert()->accept();
50
        }
51
52
    }
53
54
    public function execute($param = null)
55
    {
56
        $this->removeAll($param);
57
    }
58
59
}