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  | 
            ||
| 7 | use Sylius\Behat\Service\AutocompleteHelper;  | 
            ||
| 8 | |||
| 9 | class CreatePage extends BaseCreatePage implements CreatePageInterface  | 
            ||
| 10 | { | 
            ||
| 11 | /**  | 
            ||
| 12 |      * {@inheritdoc} | 
            ||
| 13 | */  | 
            ||
| 14 | public function setBody($body)  | 
            ||
| 18 | |||
| 19 | /**  | 
            ||
| 20 |      * {@inheritdoc} | 
            ||
| 21 | */  | 
            ||
| 22 | public function setLink($link)  | 
            ||
| 26 | |||
| 27 | /**  | 
            ||
| 28 |      * {@inheritdoc} | 
            ||
| 29 | */  | 
            ||
| 30 | public function setName($name)  | 
            ||
| 34 | |||
| 35 | /**  | 
            ||
| 36 |      * {@inheritdoc} | 
            ||
| 37 | */  | 
            ||
| 38 | public function setTitle($title)  | 
            ||
| 42 | |||
| 43 | /**  | 
            ||
| 44 |      * {@inheritdoc} | 
            ||
| 45 | */  | 
            ||
| 46 | public function chooseTaxon($taxonName)  | 
            ||
| 52 | |||
| 53 | /**  | 
            ||
| 54 |      * {@inheritdoc} | 
            ||
| 55 | */  | 
            ||
| 56 | public function attachImage($relativePath)  | 
            ||
| 60 | |||
| 61 | /**  | 
            ||
| 62 |      * {@inheritdoc} | 
            ||
| 63 | */  | 
            ||
| 64 | protected function getDefinedElements()  | 
            ||
| 65 |     { | 
            ||
| 66 | return array_merge(parent::getDefinedElements(), [  | 
            ||
| 67 | 'body' => '#lakion_cms_taxon_block_body',  | 
            ||
| 68 | 'link' => '#lakion_cms_taxon_block_linkUrl',  | 
            ||
| 69 | 'name' => '#lakion_cms_taxon_block_name',  | 
            ||
| 70 | 'taxon' => '#lakion_cms_taxon_block_taxon',  | 
            ||
| 71 | 'title' => '#lakion_cms_taxon_block_title',  | 
            ||
| 75 |