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 |
||
| 28 | final class ScenarioStateHookableScenarioTester implements ScenarioTester |
||
| 29 | { |
||
| 30 | /** |
||
| 31 | * @var ScenarioTester |
||
| 32 | */ |
||
| 33 | private $baseTester; |
||
| 34 | |||
| 35 | /** |
||
| 36 | * @var ScenarioStateHookDispatcher |
||
| 37 | */ |
||
| 38 | private $dispatcher; |
||
| 39 | |||
| 40 | /** |
||
| 41 | * @param ScenarioTester $baseTester |
||
| 42 | * @param ScenarioStateHookDispatcher $dispatcher |
||
| 43 | */ |
||
| 44 | 3 | public function __construct(ScenarioTester $baseTester, ScenarioStateHookDispatcher $dispatcher) |
|
| 49 | |||
| 50 | /** |
||
| 51 | * {@inheritdoc} |
||
| 52 | */ |
||
| 53 | 1 | View Code Duplication | public function setUp(Environment $env, FeatureNode $feature, Scenario $scenario, $skip) |
| 63 | |||
| 64 | /** |
||
| 65 | * {@inheritdoc} |
||
| 66 | */ |
||
| 67 | 1 | public function test(Environment $env, FeatureNode $feature, Scenario $scenario, $skip) |
|
| 71 | |||
| 72 | /** |
||
| 73 | * {@inheritdoc} |
||
| 74 | */ |
||
| 75 | 1 | View Code Duplication | public function tearDown(Environment $env, FeatureNode $feature, Scenario $scenario, $skip, TestResult $result) |
| 85 | } |
||
| 86 |