Completed
Push — checkout-consistent-prices ( af49ca )
by Kamil
13:24
created

PricingElement   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 2
dl 0
loc 22
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getPriceForChannel() 0 9 1
A getOriginalPriceForChannel() 0 9 1
1
<?php
2
3
/*
4
 * This file is part of the Sylius package.
5
 *
6
 * (c) Paweł Jędrzejewski
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
declare(strict_types=1);
13
14
namespace Sylius\Behat\Element\Product\ShowPage;
15
16
use FriendsOfBehat\PageObjectExtension\Element\Element;
17
18
final class PricingElement extends Element implements PricingElementInterface
19
{
20
    public function getPriceForChannel(string $channelName): string
21
    {
22
        /** @var NodeElement $priceForChannel */
23
        $channelPriceRow = $this->getDocument()->find('css', sprintf('#pricing tr:contains("%s")', $channelName));
24
25
        $priceForChannel = $channelPriceRow->find('css', 'td:nth-child(2)');
26
27
        return $priceForChannel->getText();
28
    }
29
30
    public function getOriginalPriceForChannel(string $channelName): string
31
    {
32
        /** @var NodeElement $priceForChannel */
33
        $channelPriceRow = $this->getDocument()->find('css', sprintf('#pricing tr:contains("%s")', $channelName));
34
35
        $priceForChannel = $channelPriceRow->find('css', 'td:nth-child(3)');
36
37
        return $priceForChannel->getText();
38
    }
39
}
40