Completed
Push — master ( 284884...b70f30 )
by Kamil
20:25
created

IndexPage   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
c 1
b 0
f 0
lcom 1
cbo 4
dl 0
loc 43
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 10 1
A getUsedThemeName() 0 8 1
A getRouteName() 0 4 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\Channel;
13
14
use Behat\Mink\Session;
15
use Sylius\Behat\Page\SymfonyPage;
16
use Sylius\Behat\TableManipulatorInterface;
17
use Symfony\Component\Routing\RouterInterface;
18
19
/**
20
 * @author Kamil Kokot <[email protected]>
21
 */
22
class IndexPage extends SymfonyPage implements IndexPageInterface
23
{
24
    /**
25
     * @var TableManipulatorInterface
26
     */
27
    private $tableManipulator;
28
29
    /**
30
     * {@inheritdoc}
31
     *
32
     * @param TableManipulatorInterface $tableManipulator
33
     */
34
    public function __construct(
35
        Session $session,
36
        array $parameters,
37
        RouterInterface $router,
38
        TableManipulatorInterface $tableManipulator
39
    ) {
40
        parent::__construct($session, $parameters, $router);
41
42
        $this->tableManipulator = $tableManipulator;
43
    }
44
45
    /**
46
     * {@inheritdoc}
47
     */
48
    public function getUsedThemeName($channelCode)
49
    {
50
        $table = $this->getDocument()->find('css', 'table');
51
52
        $row = $this->tableManipulator->getRowWithFields($table, ['code' => $channelCode]);
53
54
        return trim($this->tableManipulator->getFieldFromRow($table, $row, 'theme')->getText());
55
    }
56
57
    /**
58
     * {@inheritdoc}
59
     */
60
    protected function getRouteName()
61
    {
62
        return 'sylius_backend_channel_index';
63
    }
64
}
65