Completed
Push — master ( 155c16...880d18 )
by Kamil
26:05
created

ChannelIndexPage   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

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

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\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 ChannelIndexPage extends SymfonyPage
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
     * @param string $channelCode
47
     *
48
     * @return string|null
49
     */
50
    public function getUsedThemeName($channelCode)
51
    {
52
        $table = $this->getDocument()->find('css', 'table');
53
54
        $row = $this->tableManipulator->getRowWithFields($table, ['code' => $channelCode]);
55
56
        return trim($this->tableManipulator->getFieldFromRow($table, $row, 'theme')->getText());
57
    }
58
59
    /**
60
     * {@inheritdoc}
61
     */
62
    protected function getRouteName()
63
    {
64
        return 'sylius_backend_channel_index';
65
    }
66
}
67