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
Push — master ( e05945...2df00c )
by Kevin
04:58 queued 02:29
created

Price::assertPrice()   A

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 2
1
<?php
2
3
namespace Magium\Magento\Assertions\Product;
4
5
use Magium\AbstractTestCase;
6
use Magium\Assertions\SelectorAssertionInterface;
7
use Magium\Magento\Themes\AbstractThemeConfiguration;
8
use Magium\WebDriver\WebDriver;
9
10
class Price implements SelectorAssertionInterface
11
{
12
13
    const ASSERTION = 'Product\Price';
14
15
    protected $webDriver;
16
    protected $theme;
17
18
    public function __construct(
19
        WebDriver $webDriver,
20
        AbstractThemeConfiguration $theme
21
    )
22
    {
23
        $this->webDriver = $webDriver;
24
        $this->theme = $theme;
25
    }
26
27
    public function assertPrice($price, $includeCurrency = false)
28
    {
29
        return $this->assertSelector($price, $includeCurrency);
30
    }
31
32
    public function assertSelector($selector, $includeCurrency = false)
33
    {
34
        $element = $this->webDriver->byXpath($this->theme->getProductPagePriceXpath());
35
        $price = trim($element->getText());
36
        if (!$includeCurrency) {
37
            $price = preg_replace('/^\D+/', '', $price);
38
        }
39
        AbstractTestCase::assertEquals($selector, $price);
40
    }
41
42
}
43