We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
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 |
||
| 26 | class FrontendController extends PluginEngine implements Sitemap |
||
| 27 | { |
||
| 28 | |||
| 29 | /** |
||
| 30 | * @var View |
||
| 31 | */ |
||
| 32 | private $view; |
||
| 33 | |||
| 34 | /** |
||
| 35 | * @var Page |
||
| 36 | */ |
||
| 37 | private $currentPage; |
||
| 38 | |||
| 39 | /** |
||
| 40 | * PageController constructor. |
||
| 41 | * @param PageRepository $pages |
||
| 42 | * @param View $view |
||
| 43 | */ |
||
| 44 | public function __construct(PageRepository $pages, View $view) |
||
| 50 | |||
| 51 | /** |
||
| 52 | * @return mixed |
||
| 53 | */ |
||
| 54 | private function navigationData() |
||
| 58 | |||
| 59 | /** |
||
| 60 | * Usually the place for listing all the articles. (index) |
||
| 61 | * |
||
| 62 | * @param ArticleRepository $repository |
||
| 63 | * @return \Illuminate\Http\Response |
||
| 64 | */ |
||
| 65 | public function index(ArticleRepository $repository) |
||
| 71 | |||
| 72 | public function article(ArticleRepository $repository, string $slug) |
||
| 85 | |||
| 86 | public function search(ArticleRepository $repository, Request $request) |
||
| 92 | |||
| 93 | public function category(ArticleRepository $repository, int $id) |
||
| 99 | |||
| 100 | public function creator(ArticleRepository $repository, int $id) |
||
| 106 | |||
| 107 | private function articleFrontPage() |
||
| 111 | |||
| 112 | /** |
||
| 113 | * The sitemap function allows plugins to quickly and effectively |
||
| 114 | * show their content for search engines in a modular way. |
||
| 115 | * |
||
| 116 | * @param SitemapGenerator $sitemap |
||
| 117 | * @return SitemapGenerator |
||
| 118 | */ |
||
| 119 | View Code Duplication | public function sitemap(SitemapGenerator $sitemap) |
|
| 131 | } |
||
| 132 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.