Code Duplication    Length = 77-77 lines in 2 locations

src/Console/Menus/Menu.php 1 location

@@ 14-90 (lines=77) @@
11
 *
12
 * @package Acacha\AdminLTETemplateLaravel\Console\Menus
13
 */
14
abstract class Menu implements GeneratesCode
15
{
16
17
    /**
18
     * Compiler for stub file.
19
     *
20
     * @var StubFileCompiler
21
     */
22
    protected $compiler;
23
24
    /**
25
     * Compiler for stub file.
26
     *
27
     * @var Filesystem
28
     */
29
    protected $filesystem;
30
31
    /**
32
     * Replacements.
33
     *
34
     * @var array
35
     */
36
    protected $replacements;
37
38
    /**
39
     * Route constructor.
40
     *
41
     * @param StubFileCompiler $compiler
42
     * @param Filesystem $filesystem
43
     */
44
    public function __construct(StubFileCompiler $compiler, Filesystem $filesystem)
45
    {
46
        $this->compiler = $compiler;
47
        $this->filesystem = $filesystem;
48
    }
49
50
    /**
51
     * @return array
52
     */
53
    public function getReplacements()
54
    {
55
        return $this->replacements;
56
    }
57
58
    /**
59
     * @param array $replacements
60
     */
61
    public function setReplacements($replacements)
62
    {
63
        $this->replacements = $replacements;
64
    }
65
66
    /**
67
     * Generate route code.
68
     */
69
    public function code()
70
    {
71
        return $this->compiler->compile(
72
            $this->filesystem->get($this->getStubPath()),
73
            $this->obtainReplacements()
74
        );
75
    }
76
77
    /**
78
     * Get stub path.
79
     *
80
     * @return mixed
81
     */
82
    abstract protected function getStubPath();
83
84
    /**
85
     * Obtain replacements for stub.
86
     *
87
     * @return mixed
88
     */
89
    abstract protected function obtainReplacements();
90
}
91

src/Console/Routes/Route.php 1 location

@@ 13-89 (lines=77) @@
10
 *
11
 * @package Acacha\AdminLTETemplateLaravel\Console\Routes
12
 */
13
abstract class Route implements GeneratesCode
14
{
15
16
    /**
17
     * Compiler for stub file.
18
     *
19
     * @var StubFileCompiler
20
     */
21
    protected $compiler;
22
23
    /**
24
     * Compiler for stub file.
25
     *
26
     * @var Filesystem
27
     */
28
    protected $filesystem;
29
30
    /**
31
     * Replacements.
32
     *
33
     * @var array
34
     */
35
    protected $replacements;
36
37
    /**
38
     * Route constructor.
39
     *
40
     * @param StubFileCompiler $compiler
41
     * @param Filesystem $filesystem
42
     */
43
    public function __construct(StubFileCompiler $compiler, Filesystem $filesystem)
44
    {
45
        $this->compiler = $compiler;
46
        $this->filesystem = $filesystem;
47
    }
48
49
    /**
50
     * @return array
51
     */
52
    public function getReplacements()
53
    {
54
        return $this->replacements;
55
    }
56
57
    /**
58
     * @param array $replacements
59
     */
60
    public function setReplacements($replacements)
61
    {
62
        $this->replacements = $replacements;
63
    }
64
65
    /**
66
     * Generate route code.
67
     */
68
    public function code()
69
    {
70
        return $this->compiler->compile(
71
            $this->filesystem->get($this->getStubPath()),
72
            $this->obtainReplacements()
73
        );
74
    }
75
76
    /**
77
     * Get stub path.
78
     *
79
     * @return mixed
80
     */
81
    abstract protected function getStubPath();
82
83
    /**
84
     * Obtain replacements for stub.
85
     *
86
     * @return mixed
87
     */
88
    abstract protected function obtainReplacements();
89
}
90