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 |
||
| 16 | class MockeryMockingStrategy extends AbstractMockingStrategy |
||
| 17 | { |
||
| 18 | /** |
||
| 19 | * MockeryMockingStrategy constructor. |
||
| 20 | */ |
||
| 21 | 1 | public function __construct() |
|
| 25 | |||
| 26 | /** |
||
| 27 | * @param string $fqcn |
||
| 28 | * @return MockInterface |
||
| 29 | * |
||
| 30 | * @throws MockNotCreatedException |
||
| 31 | */ |
||
| 32 | 5 | public function build(string $fqcn) |
|
| 46 | |||
| 47 | /** |
||
| 48 | * @param MockInterface $mock |
||
| 49 | * @param StubSet $stubs |
||
| 50 | * @return void |
||
| 51 | * |
||
| 52 | * @throws InvalidArgumentException |
||
| 53 | */ |
||
| 54 | 2 | View Code Duplication | public function decorate($mock, StubSet $stubs) |
| 68 | |||
| 69 | /** |
||
| 70 | * @param MockInterface $mock |
||
| 71 | * @return MockInterface |
||
| 72 | * |
||
| 73 | * @throws InvalidArgumentException |
||
| 74 | */ |
||
| 75 | 3 | public function get($mock) |
|
| 81 | } |
||
| 82 |