Completed
Push — symfony3-fqcn ( 04e8c2...ea8d6b )
by Kamil
18:56
created

UpdatePage   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 46
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 2
dl 0
loc 46
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getRatio() 0 4 1
A changeRatio() 0 4 1
A isSourceCurrencyDisabled() 0 4 1
A isTargetCurrencyDisabled() 0 4 1
A getDefinedElements() 0 8 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
namespace Sylius\Behat\Page\Admin\ExchangeRate;
13
14
use Sylius\Behat\Page\Admin\Crud\UpdatePage as BaseUpdatePage;
15
16
/**
17
 * @author Jan Góralski <[email protected]>
18
 */
19
class UpdatePage extends BaseUpdatePage implements UpdatePageInterface
20
{
21
    /**
22
     * {@inheritdoc}
23
     */
24
    public function getRatio()
25
    {
26
        return $this->getElement('ratio')->getValue();
27
    }
28
29
    /**
30
     * {@inheritdoc}
31
     */
32
    public function changeRatio($ratio)
33
    {
34
        $this->getElement('ratio')->setValue($ratio);
35
    }
36
37
    /**
38
     * {@inheritdoc}
39
     */
40
    public function isSourceCurrencyDisabled()
41
    {
42
        return null !== $this->getElement('sourceCurrency')->getAttribute('disabled');
43
    }
44
45
    /**
46
     * {@inheritdoc}
47
     */
48
    public function isTargetCurrencyDisabled()
49
    {
50
        return null !== $this->getElement('targetCurrency')->getAttribute('disabled');
51
    }
52
53
    /**
54
     * {@inheritdoc}
55
     */
56
    protected function getDefinedElements()
57
    {
58
        return array_merge(parent::getDefinedElements(), [
59
            'ratio' => '#sylius_exchange_rate_ratio',
60
            'sourceCurrency' => '#sylius_exchange_rate_sourceCurrency',
61
            'targetCurrency' => '#sylius_exchange_rate_targetCurrency',
62
        ]);
63
    }
64
}
65