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 |
||
14 | class PhpMatcher implements Context |
||
15 | { |
||
16 | use ApiTrait; |
||
17 | |||
18 | /** @var Factory */ |
||
19 | private $factory; |
||
20 | |||
21 | public function __construct(HttpHistory $history) |
||
26 | |||
27 | /** @Then the response content should match :pattern */ |
||
28 | View Code Duplication | public function response_content_should_match(string $pattern) |
|
45 | |||
46 | /** @Then the response content should not match :pattern */ |
||
47 | View Code Duplication | public function response_content_should_not_match(string $pattern) |
|
64 | |||
65 | /** @Then the response content should match: */ |
||
66 | View Code Duplication | public function response_content_should_match_PyString(PyStringNode $pattern) |
|
77 | |||
78 | /** @Then the response content should match: */ |
||
79 | View Code Duplication | public function response_content_should_not_match_PyString(PyStringNode $pattern) |
|
90 | } |
||
91 |