We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
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 |
||
5 | class CrudPanelColumnsTest extends BaseCrudPanelTest |
||
6 | { |
||
7 | private $oneColumnArray = [ |
||
8 | 'name' => 'column1', |
||
9 | 'label' => 'Column1', |
||
10 | ]; |
||
11 | |||
12 | private $otherOneColumnArray = [ |
||
13 | 'name' => 'column4', |
||
14 | 'label' => 'Column4', |
||
15 | ]; |
||
16 | |||
17 | private $twoColumnsArray = [ |
||
18 | [ |
||
19 | 'name' => 'column1', |
||
20 | 'label' => 'Column1', |
||
21 | ], |
||
22 | [ |
||
23 | 'name' => 'column2', |
||
24 | 'label' => 'Column2', |
||
25 | ], |
||
26 | ]; |
||
27 | |||
28 | private $expectedTwoColumnsArray = [ |
||
29 | 'column1' => [ |
||
30 | 'name' => 'column1', |
||
31 | 'label' => 'Column1', |
||
32 | ], |
||
33 | 'column2' => [ |
||
34 | 'name' => 'column2', |
||
35 | 'label' => 'Column2', |
||
36 | ], |
||
37 | ]; |
||
38 | |||
39 | private $threeColumnsArray = [ |
||
40 | [ |
||
41 | 'name' => 'column1', |
||
42 | 'label' => 'Column1', |
||
43 | ], |
||
44 | [ |
||
45 | 'name' => 'column2', |
||
46 | 'label' => 'Column2', |
||
47 | ], |
||
48 | [ |
||
49 | 'name' => 'column3', |
||
50 | 'label' => 'Column3', |
||
51 | ], |
||
52 | ]; |
||
53 | |||
54 | private $expectedThreeColumnsArray = [ |
||
55 | 'column1' => [ |
||
56 | 'name' => 'column1', |
||
57 | 'label' => 'Column1', |
||
58 | ], |
||
59 | 'column2' => [ |
||
60 | 'name' => 'column2', |
||
61 | 'label' => 'Column2', |
||
62 | ], |
||
63 | 'column3' => [ |
||
64 | 'name' => 'column3', |
||
65 | 'label' => 'Column3', |
||
66 | ], |
||
67 | ]; |
||
68 | |||
69 | View Code Duplication | public function testAddColumnByName() |
|
76 | |||
77 | public function testAddColumnsByName() |
||
84 | |||
85 | View Code Duplication | public function testAddColumnAsArray() |
|
92 | |||
93 | View Code Duplication | public function testAddColumnsAsArray() |
|
100 | |||
101 | public function testAddColumnNotArray() |
||
107 | |||
108 | View Code Duplication | public function testMoveColumnBefore() |
|
118 | |||
119 | View Code Duplication | public function testMoveColumnBeforeUnknownColumnName() |
|
127 | |||
128 | View Code Duplication | public function testMoveColumnAfter() |
|
138 | |||
139 | View Code Duplication | public function testMoveColumnAfterUnknownColumnName() |
|
147 | |||
148 | public function testRemoveColumnByName() |
||
158 | |||
159 | View Code Duplication | public function testRemoveUnknownColumnName() |
|
170 | |||
171 | public function testRemoveColumnsByName() |
||
181 | |||
182 | View Code Duplication | public function testRemoveUnknownColumnsByName() |
|
193 | |||
194 | public function testSetColumnDetails() |
||
200 | |||
201 | public function testSetColumnsDetails() |
||
207 | |||
208 | public function testSetColumnOrder() |
||
214 | |||
215 | public function testSetColumnsOrder() |
||
221 | |||
222 | public function testOrderColumns() |
||
228 | } |
||
229 |
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.