Failed Conditions
Push — modify-scrutinizeryml ( 361e25...08b4c1 )
by Kentaro
63:54 queued 57:30
created

OrderManagePage   A

Complexity

Total Complexity 31

Size/Duplication

Total Lines 233
Duplicated Lines 30.04 %

Coupling/Cohesion

Components 2
Dependencies 1

Importance

Changes 0
Metric Value
dl 70
loc 233
rs 9.92
c 0
b 0
f 0
wmc 31
lcom 2
cbo 1

31 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A go() 0 5 1
A at() 0 5 1
A 検索() 0 6 1
A 詳細検索設定() 0 7 1
A 入力_ご注文者お名前() 0 5 1
A 入力_ご注文者お名前フリガナ() 0 5 1
A 詳細検索_電話番号() 8 8 1
A 受注CSVダウンロード実行() 7 7 1
A 受注CSV出力項目設定() 7 7 1
A 配送CSVダウンロード実行() 7 7 1
A 配送CSV出力項目設定() 7 7 1
A すべてチェック() 0 5 1
A 要素をクリック() 0 5 1
A PDFフォームを入力() 0 5 1
A 一覧_編集() 0 4 1
A 一覧_削除() 0 5 1
A Accept_削除() 0 6 1
A Cancel_削除() 0 5 1
A 一覧_メール通知() 11 11 1
A 一覧_選択() 0 5 1
A 一覧_全選択() 0 5 1
A 個別メール送信() 11 11 1
A 一括メール送信() 0 10 1
A 一覧_注文番号() 0 4 1
A 受注ステータス検索() 0 6 1
A 受注ステータス変更() 0 6 1
A 出荷済にする() 12 12 1
A 取得_出荷伝票番号() 0 4 1
A 取得_出荷日() 0 4 1
A 取得_ステータス() 0 4 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
namespace Page\Admin;
4
5
6
class OrderManagePage extends AbstractAdminPageStyleGuide
7
{
8
    public static $検索条件_受注ステータス = ['id' => 'admin_search_order_status'];
9
    public static $検索結果_メッセージ = '#search_form #search_total_count';
10
    public static $検索結果_エラーメッセージ = '//*[@id="page_admin_order"]/div[1]/div[3]/div[3]/div/div/div[1]/div/div[1]';
11
    public static $詳細検索ボタン = '//*[@id="search_form"]/div[1]/div/div/div[3]/a/i/span';
12
    public static $タイトル要素 = '.c-container .c-contentsArea .c-pageTitle .c-pageTitle__titles';
13
14
    /**
15
     * OrderListPage constructor.
16
     */
17
    public function __construct(\AcceptanceTester $I)
18
    {
19
        parent::__construct($I);
20
    }
21
22
    public static function go(\AcceptanceTester $I)
23
    {
24
        $page = new self($I);
25
        return $page->goPage('/order', '受注一覧受注管理');
26
    }
27
28
    public static function at(\AcceptanceTester $I)
29
    {
30
        $page = new self($I);
31
        return $page->atPage('受注一覧受注管理');
32
    }
33
34
    public function 検索($value = '')
35
    {
36
        $this->tester->fillField(['id' => 'admin_search_order_multi'], $value);
37
        $this->tester->click('#search_form #search_submit');
38
        return $this;
39
    }
40
41
    public function 詳細検索設定()
42
    {
43
        $this->tester->click(self::$詳細検索ボタン);
44
        $this->tester->waitForElementVisible(['id' => 'searchDetail']);
45
        $this->tester->wait(0.5);
46
        return $this;
47
    }
48
49
    public function 入力_ご注文者お名前($value)
50
    {
51
        $this->tester->fillField(['id' => 'admin_search_order_name'], $value);
52
        return $this;
53
    }
54
55
    public function 入力_ご注文者お名前フリガナ($value)
56
    {
57
        $this->tester->fillField(['id' => 'admin_search_order_kana'], $value);
58
        return $this;
59
    }
60
61 View Code Duplication
    public function 詳細検索_電話番号($value = '')
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...
62
    {
63
        $this->tester->click(self::$詳細検索ボタン);
64
        $this->tester->wait(1);
65
        $this->tester->fillField(['id' => 'admin_search_order_phone_number'], $value);
66
        $this->tester->click('#search_form #search_submit');
67
        return $this;
68
    }
69
70 View Code Duplication
    public function 受注CSVダウンロード実行()
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...
71
    {
72
        $this->tester->click(['id' => 'csvDownloadDropDown']);
73
        $this->tester->waitForElementVisible(['id' => 'orderCsvDownload']);
74
        $this->tester->click(['id' => 'orderCsvDownload']);
75
        return $this;
76
    }
77
78 View Code Duplication
    public function 受注CSV出力項目設定()
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...
79
    {
80
        $this->tester->click(['id' => 'csvSettingDropDown']);
81
        $this->tester->waitForElementVisible(['id' => 'orderCsvSetting']);
82
        $this->tester->click(['id' => 'orderCsvSetting']);
83
        return $this;
84
    }
85
86 View Code Duplication
    public function 配送CSVダウンロード実行()
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...
87
    {
88
        $this->tester->click(['id' => 'csvDownloadDropDown']);
89
        $this->tester->waitForElementVisible(['id' => 'shippingCsvDownload']);
90
        $this->tester->click(['id' => 'shippingCsvDownload']);
91
        return $this;
92
    }
93
94 View Code Duplication
    public function 配送CSV出力項目設定()
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...
95
    {
96
        $this->tester->click(['id' => 'csvSettingDropDown']);
97
        $this->tester->waitForElementVisible(['id' => 'shippingCsvSetting']);
98
        $this->tester->click(['id' => 'shippingCsvSetting']);
99
        return $this;
100
    }
101
102
    public function すべてチェック()
103
    {
104
        $this->tester->click('#form_bulk #toggle_check_all');
105
        return $this;
106
    }
107
108
    public function 要素をクリック($element)
109
    {
110
        $this->tester->click($element);
111
        return $this;
112
    }
113
114
    public function PDFフォームを入力($elId, $value)
115
    {
116
        $this->tester->fillField($elId, $value);
117
        return $this;
118
    }
119
120
    public function 一覧_編集($rowNum)
121
    {
122
        $this->tester->click("#search_result > tbody > tr:nth-child(${rowNum}) a.action-edit");
123
    }
124
125
    public function 一覧_削除()
126
    {
127
        $this->tester->click("#form_bulk > div.row.justify-content-between.mb-2 .btn-bulk-wrapper button.btn.btn-ec-delete");
128
        return $this;
129
    }
130
131
    public function Accept_削除()
132
    {
133
        $this->tester->waitForElementVisible(['id' => 'btn_bulk_delete']);
134
        $this->tester->click("#btn_bulk_delete");
135
        return $this;
136
    }
137
138
    public function Cancel_削除()
139
    {
140
        $this->tester->click("#bulkDeleteModal > div > div > div.modal-footer > button.btn.btn-ec-sub");
141
        return $this;
142
    }
143
144 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...
145
    {
146
        $this->tester->click(['css' => "#search_result > tbody > tr:nth-child(${rowNum}) > td.align-middle.pr-3.text-center > div > div:nth-child(1) > a"]);
147
        $this->tester->waitForElementVisible(['id' => 'sentUpdateModal']);
148
        $this->tester->wait(2);
149
        $this->tester->scrollTo(['id' => 'bulkChange']);
150
        $this->tester->click(['id' => 'bulkChange']);
151
        $this->tester->wait(5);
152
        $this->tester->waitForElementVisible(['id' => 'bulkChangeComplete']);
153
        return $this;
154
    }
155
156
    public function 一覧_選択($rowNum)
157
    {
158
        $this->tester->checkOption(['css' => "#search_result > tbody > tr:nth-child(${rowNum}) > td > input[type=checkbox]"]);
159
        return $this;
160
    }
161
162
    public function 一覧_全選択()
163
    {
164
        $this->tester->checkOption('#toggle_check_all');
165
        return $this;
166
    }
167
168
169 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...
170
    {
171
        $this->tester->click(['css' => "#search_result > tbody > tr:nth-child(${rowNum}) > td.align-middle.pr-3.text-center > div > div:nth-child(1) > a"]);
172
        $this->tester->waitForElementVisible(['id' => 'sentUpdateModal']);
173
        $this->tester->wait(2);
174
        $this->tester->scrollTo(['id' => 'bulkChange']);
175
        $this->tester->click(['id' => 'bulkChange']);
176
        $this->tester->wait(5);
177
        $this->tester->waitForElementVisible(['id' => 'bulkChangeComplete']);
178
        return $this;
179
    }
180
181
    public function 一括メール送信()
182
    {
183
        $this->tester->click(['id' => 'bulkSendMail']);
184
        $this->tester->waitForElementVisible(['id' => 'sentUpdateModal']);
185
        $this->tester->wait(1);
186
        $this->tester->click(['id' => 'bulkChange']);
187
        $this->tester->wait(5);
188
        $this->tester->waitForElementVisible(['id' => 'bulkChangeComplete']);
189
        return $this;
190
    }
191
192
    public function 一覧_注文番号($rowNum)
193
    {
194
        return $this->tester->grabTextFrom("#search_result > tbody > tr:nth-child($rowNum) a.action-edit");
195
    }
196
197
    public function 受注ステータス検索($value = '')
198
    {
199
        $this->tester->checkOption(['id' => 'admin_search_order_status_'.$value]);
200
        $this->tester->click('#search_form #search_submit');
201
        return $this;
202
    }
203
204
    public function 受注ステータス変更($option = [])
205
    {
206
        $this->tester->selectOption('#option_bulk_status', $option);
207
        $this->tester->click('#form_bulk #btn_bulk_status');
208
        return $this;
209
    }
210
211 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...
212
    {
213
        $this->tester->click("#search_result > tbody > tr:nth-child($rowNum) a[data-type='status']");
214
        $this->tester->waitForElementVisible(['id' => 'sentUpdateModal']);
215
        $this->tester->wait(2);
216
        $this->tester->click(['id' => 'notificationMail']);
217
        $this->tester->scrollTo(['id' => 'bulkChange']);
218
        $this->tester->click(['id' => 'bulkChange']);
219
        $this->tester->wait(5);
220
        $this->tester->waitForElementVisible(['id' => 'bulkChangeComplete']);
221
        return $this;
222
    }
223
224
    public function 取得_出荷伝票番号($rowNum)
225
    {
226
        return $this->tester->grabValueFrom("#search_result > tbody > tr:nth-child(${rowNum}) > td:nth-child(8) > div > input");
227
    }
228
229
    public function 取得_出荷日($rowNum)
230
    {
231
        return $this->tester->grabTextFrom("#search_result > tbody > tr:nth-child(${rowNum}) > td:nth-child(7)");
232
    }
233
234
    public function 取得_ステータス($rowNum)
235
    {
236
        return $this->tester->grabTextFrom("#search_result > tbody > tr:nth-child(${rowNum}) > td:nth-child(4) > span");
237
    }
238
}
239