Failed Conditions
Push — sf/last-boss ( 98c677...e157b8 )
by Kiyotaka
05:51
created

NewsManagePage   A

Complexity

Total Complexity 9

Size/Duplication

Total Lines 69
Duplicated Lines 11.59 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
dl 8
loc 69
rs 10
c 0
b 0
f 0
wmc 9
lcom 1
cbo 1

9 Methods

Rating   Name   Duplication   Size   Complexity  
A 一覧_削除() 0 6 1
A __construct() 0 4 1
A go() 0 6 1
A at() 0 6 1
A 新規登録() 0 5 1
A 一覧_編集() 0 7 1
A 一覧_タイトル() 0 4 1
A 一覧_下へ() 0 7 1
A ポップアップを受け入れます() 8 8 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
3
/*
4
 * This file is part of EC-CUBE
5
 *
6
 * Copyright(c) LOCKON CO.,LTD. All Rights Reserved.
7
 *
8
 * http://www.lockon.co.jp/
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code.
12
 */
13
14
namespace Page\Admin;
15
16
class NewsManagePage extends AbstractAdminPage
17
{
18
    public static $登録完了メッセージ = '.c-container .c-contentsArea .alert-success';
19
20
    /**
21
     * ContentsRegisterPage constructor.
22
     */
23
    public function __construct(\AcceptanceTester $I)
24
    {
25
        parent::__construct($I);
26
    }
27
28
    public static function go($I)
29
    {
30
        $page = new self($I);
31
32
        return $page->goPage('/content/news', 'コンテンツ管理新着情報管理');
33
    }
34
35
    public static function at($I)
36
    {
37
        $page = new self($I);
38
39
        return $page->atPage('コンテンツ管理新着情報管理');
40
    }
41
42
    public function 新規登録()
43
    {
44
        $this->tester->click('.c-contentsArea .c-contentsArea__cols .c-contentsArea__primaryCol .justify-content-between #addNew
45
        ');
46
    }
47
48
    public function 一覧_編集($rowNum)
49
    {
50
        $this->tester->click(" ul .list-group li:nth-child(${rowNum})
51
     div > div :nth-child(4) > a");
52
53
        return $this;
54
    }
55
56
    public function 一覧_タイトル($rowNum)
57
    {
58
        return $this->tester->grabTextFrom(['css' => "ul.list-group li:nth-child(${rowNum}) div > div:nth-child(4) a"]);
59
    }
60
61
    public function 一覧_下へ($rowNum)
62
    {
63
        $this->tester->click(" ul .list-group li:nth-child(${rowNum})
64
     div > div :nth-child(4) > a");
65
66
        return $this;
67
    }
68
69
    public function 一覧_削除($rowNum)
70
    {
71
        $this->tester->click("ul.list-group li:nth-child(${rowNum}) div > div:nth-child(5) > div > div:nth-child(3) > a.btn-ec-actionIcon");
72
73
        return $this;
74
    }
75
76 View Code Duplication
    public function ポップアップを受け入れます($rowNum)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
77
    {
78
        $modal = "ul.list-group li:nth-child(${rowNum}) div > div:nth-child(5) > div > div:nth-child(3) div.modal";
79
        $this->tester->waitForElementVisible(['css' => $modal]);
80
        $this->tester->click($modal.' .modal-footer a.btn-ec-delete');
81
82
        return $this;
83
    }
84
}
85