These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace Acacha\AdminLTETemplateLaravel\Console\Routes; |
||
4 | |||
5 | use Acacha\Filesystem\Compiler\StubFileCompiler; |
||
6 | use Acacha\Filesystem\Filesystem; |
||
7 | |||
8 | /** |
||
9 | * Class RegularRoute. |
||
10 | * |
||
11 | * @package Acacha\AdminLTETemplateLaravel\Console\Routes |
||
12 | */ |
||
13 | View Code Duplication | class RegularRoute extends Route |
|
0 ignored issues
–
show
|
|||
14 | { |
||
15 | |||
16 | /** |
||
17 | * RegularRoute constructor. |
||
18 | * |
||
19 | * @param StubFileCompiler $compiler |
||
20 | * @param Filesystem $filesystem |
||
21 | */ |
||
22 | public function __construct(StubFileCompiler $compiler, Filesystem $filesystem) |
||
23 | { |
||
24 | parent::__construct($compiler, $filesystem); |
||
25 | } |
||
26 | |||
27 | /** |
||
28 | * Get path to stub. |
||
29 | * |
||
30 | * @return string |
||
31 | */ |
||
32 | protected function getStubPath() |
||
33 | { |
||
34 | return __DIR__ . '/../stubs/route.stub'; |
||
35 | } |
||
36 | |||
37 | /** |
||
38 | * @return array |
||
39 | */ |
||
40 | protected function obtainReplacements() |
||
41 | { |
||
42 | return [ |
||
43 | 'ROUTE_LINK' => $link = $this->getReplacements()[0], |
||
44 | 'ROUTE_VIEW' => $this->getReplacements()[1], |
||
45 | 'ROUTE_METHOD' => $this->getReplacements()[2], |
||
46 | 'ROUTE_NAME' => dot_path($link), |
||
47 | ]; |
||
48 | } |
||
49 | } |
||
50 |
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.