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 |
||
| 8 | class ScriptCommandTest extends TestCase |
||
| 9 | { |
||
|
|
|||
| 10 | /** @var null|\Magento\Framework\App\ProductMetadata */ |
||
| 11 | protected $productMetadata = null; |
||
| 12 | |||
| 13 | public function testExecute() |
||
| 42 | |||
| 43 | /** |
||
| 44 | * @return string |
||
| 45 | */ |
||
| 46 | protected function getMagentoVersion() |
||
| 50 | |||
| 51 | /** |
||
| 52 | * |
||
| 53 | * @return mixed |
||
| 54 | */ |
||
| 55 | protected function getMagentoEdition() |
||
| 59 | |||
| 60 | /** |
||
| 61 | * @return \Magento\Framework\App\ProductMetadata |
||
| 62 | */ |
||
| 63 | View Code Duplication | protected function getProductMetadata() |
|
| 72 | } |
||
| 73 |