Completed
Push — master ( fc3d6f...f7b1d9 )
by Sergi Tur
28:05
created

src/Console/Routes/ControllerRoute.php (1 issue)

Upgrade to new PHP Analysis Engine

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 ControllerRoute.
10
 *
11
 * @package Acacha\AdminLTETemplateLaravel\Console\Routes
12
 */
13 View Code Duplication
class ControllerRoute extends Route
0 ignored issues
show
This class seems to be duplicated in your project.

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.

Loading history...
14
{
15
    use Controller;
16
17
    /**
18
     * Route constructor.
19
     *
20
     * @param StubFileCompiler $compiler
21
     * @param Filesystem $filesystem
22
     */
23
    public function __construct(StubFileCompiler $compiler, Filesystem $filesystem)
24
    {
25
        parent::__construct($compiler, $filesystem);
26
    }
27
28
    /**
29
     * Get stub path.
30
     *
31
     * @return mixed
32
     */
33
    protected function getStubPath()
34
    {
35
        return __DIR__ . '/../stubs/route_with_controller.stub';
36
    }
37
38
    /**
39
     * Obtain replacements.
40
     *
41
     * @return array
42
     */
43
    protected function obtainReplacements()
44
    {
45
        return [
46
            'ROUTE_LINK' => $link = $this->getReplacements()[0],
47
            'ROUTE_CONTROLLER' => $this->controller($this->getReplacements()[1]),
48
            'ROUTE_METHOD' => $this->getReplacements()[2],
49
            'ROUTE_NAME' => dot_path($link),
50
        ];
51
    }
52
}
53