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 |
||
| 11 | abstract class BasePresenter extends \Nette\Application\UI\Presenter |
||
| 12 | { |
||
| 13 | /** |
||
| 14 | * |
||
| 15 | * @var [type] |
||
| 16 | */ |
||
| 17 | protected $em; |
||
| 18 | |||
| 19 | /** |
||
| 20 | * |
||
| 21 | * |
||
| 22 | * @return [type] [description] |
||
|
|
|||
| 23 | */ |
||
| 24 | abstract protected function getLanguageId(); |
||
| 25 | |||
| 26 | /** |
||
| 27 | * |
||
| 28 | * |
||
| 29 | * @return [type] [description] |
||
| 30 | */ |
||
| 31 | protected function startUp() |
||
| 35 | |||
| 36 | /** |
||
| 37 | * |
||
| 38 | * |
||
| 39 | * @return [type] [description] |
||
| 40 | */ |
||
| 41 | protected function getSettings() |
||
| 53 | |||
| 54 | /** |
||
| 55 | * Injects entity manager. |
||
| 56 | * |
||
| 57 | * @param \Doctrine\ORM\EntityManager $em |
||
| 58 | * |
||
| 59 | * @return BasePresenter |
||
| 60 | * @throws \Nette\InvalidStateException |
||
| 61 | */ |
||
| 62 | public function injectEntityManager(\Doctrine\ORM\EntityManager $em) |
||
| 72 | |||
| 73 | /** |
||
| 74 | * Generate sitemap.xml file in www (public) directory. |
||
| 75 | * |
||
| 76 | * @return XML sitemap |
||
| 77 | */ |
||
| 78 | View Code Duplication | public function generateSitemap() |
|
| 95 | |||
| 96 | /** |
||
| 97 | * Get single sitemap link url address. |
||
| 98 | * |
||
| 99 | * @param \WebCMS2\Entity\Page $page Page entity object. |
||
| 100 | * @return string Url address of the link. |
||
| 101 | */ |
||
| 102 | View Code Duplication | private function getSitemapLink($page) |
|
| 110 | |||
| 111 | /** |
||
| 112 | * |
||
| 113 | * |
||
| 114 | * @return [type] [description] |
||
| 115 | */ |
||
| 116 | protected function getAllLanguages() |
||
| 127 | |||
| 128 | /** |
||
| 129 | * |
||
| 130 | * |
||
| 131 | * @param [type] $name [description] |
||
| 132 | * @return [type] [description] |
||
| 133 | */ |
||
| 134 | protected function createObject($name) |
||
| 143 | } |
||
| 144 |
This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.