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.

Customer::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 18
Code Lines 15

Duplication

Lines 18
Ratio 100 %

Importance

Changes 0
Metric Value
dl 18
loc 18
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 15
nc 1
nop 7
1
<?php
2
3
namespace Magium\Magento\Navigators\Admin;
4
5
use Magium\Magento\AbstractMagentoTestCase;
6
use Magium\Magento\Actions\Admin\Tables\ClearTableFilters;
7
use Magium\Magento\Actions\Admin\Tables\ClickButton;
8
use Magium\Magento\Actions\Admin\WaitForLoadingMask;
9
use Magium\Magento\Navigators\Admin\Customer\AbstractCustomerNavigation;
10
use Magium\Magento\Themes\Admin\ThemeConfiguration;
11
use Magium\Navigators\NavigatorInterface;
12
use Magium\WebDriver\ExpectedCondition;
13
use Magium\WebDriver\WebDriver;
14
15
class Customer implements NavigatorInterface
16
{
17
    const NAVIGATOR = 'Admin\Customer';
18
19
    protected $webDriver;
20
    protected $themeConfiguration;
21
    protected $adminLogin;
22
    protected $adminMenuNavigator;
23
    protected $clearTableFilters;
24
    protected $clickButton;
25
    protected $waitForLoadingMask;
26
    protected $testCase;
27
28 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...
29
        WebDriver                   $webDriver,
30
        ThemeConfiguration     $themeConfiguration,
31
        AdminMenu          $adminMenuNavigator,
32
        ClearTableFilters           $clearTableFilters,
33
        ClickButton                 $clickButton,
34
        WaitForLoadingMask          $waitForLoadingMask,
35
        AbstractMagentoTestCase     $testCase
36
    )
37
    {
38
        $this->webDriver                = $webDriver;
39
        $this->themeConfiguration       = $themeConfiguration;
40
        $this->adminMenuNavigator       = $adminMenuNavigator;
41
        $this->clearTableFilters        = $clearTableFilters;
42
        $this->clickButton              = $clickButton;
43
        $this->waitForLoadingMask       = $waitForLoadingMask;
44
        $this->testCase                 = $testCase;
45
    }
46
47
    public function navigateTo(AbstractCustomerNavigation $navigation)
48
    {
49
50
        $this->adminMenuNavigator->navigateTo('Customers/Manage Customers');
51
52
        $this->clearTableFilters->clear();
53
54
        $parts = explode('-', $navigation->getSelectorID());
55
        foreach ($parts as $part) {
56
            $element = $this->webDriver->byId($part);
57
            $element->sendKeys($navigation->getSearch());
58
        }
59
60
        $this->clickButton->click($this->themeConfiguration->getSearchButtonText());
61
        $this->testCase->sleep('100ms');
62
        $this->waitForLoadingMask->wait();
63
64
        $selectXpath = $this->themeConfiguration->getSelectCustomerXpath($navigation->getSearch());
65
66
        $this->testCase->assertElementDisplayed($selectXpath, WebDriver::BY_XPATH);
67
        $element = $this->webDriver->byXpath($selectXpath);
68
69
        $element->click();
70
        $elementExists = $this->testCase->getTranslator()->translatePlaceholders('//h4[.="{{Personal Information}}"]');
71
        $this->webDriver->wait()->until(ExpectedCondition::elementExists($elementExists, WebDriver::BY_XPATH));
0 ignored issues
show
Documentation introduced by
\Magium\WebDriver\Expect...er\WebDriver::BY_XPATH) is of type object<Facebook\WebDrive...riverExpectedCondition>, but the function expects a callable.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
72
73
        $element = $this->webDriver->byXpath($elementExists);
74
75
        $this->webDriver->wait()->until(ExpectedCondition::visibilityOf($element));
0 ignored issues
show
Documentation introduced by
\Magium\WebDriver\Expect...:visibilityOf($element) is of type object<Magium\WebDriver\ExpectedCondition>, but the function expects a callable.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
76
77
    }
78
79
}