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 |
||
20 | class GraphDumpSchemaCommandTest extends TestCase |
||
21 | { |
||
22 | /** |
||
23 | * @var Command |
||
24 | */ |
||
25 | private $command; |
||
26 | |||
27 | /** |
||
28 | * @var CommandTester |
||
29 | */ |
||
30 | private $commandTester; |
||
31 | |||
32 | /** |
||
33 | * @var string |
||
34 | */ |
||
35 | private $cacheDir; |
||
36 | |||
37 | public function setUp() |
||
49 | |||
50 | /** |
||
51 | * @param $format |
||
52 | * @param bool $withFormatOption |
||
53 | * @dataProvider formatDataProvider |
||
54 | */ |
||
55 | public function testDump($format, $withFormatOption = true) |
||
73 | |||
74 | View Code Duplication | public function testClassicJsonFormat() |
|
88 | |||
89 | View Code Duplication | public function testModernJsonFormat() |
|
103 | |||
104 | /** |
||
105 | * @expectedException \InvalidArgumentException |
||
106 | * @expectedExceptionMessage Unknown format "fake". |
||
107 | */ |
||
108 | public function testInvalidFormat() |
||
115 | |||
116 | /** |
||
117 | * @expectedException \InvalidArgumentException |
||
118 | * @expectedExceptionMessage "modern" and "classic" options should not be used together. |
||
119 | */ |
||
120 | public function testInvalidModernAndClassicUsedTogether() |
||
129 | |||
130 | public function formatDataProvider() |
||
138 | |||
139 | private function assertCommandExecution(array $input, $expectedFile, $actualFile, $expectedStatusCode = 0) |
||
146 | } |
||
147 |
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.