Code Duplication    Length = 52-52 lines in 3 locations

src/Schemas/Naming/CrudController.php 1 location

@@ 7-58 (lines=52) @@
4
5
use Webfactor\Laravel\Generators\Contracts\NamingAbstract;
6
7
class CrudController extends NamingAbstract
8
{
9
    private $path = 'Http/Controllers/Admin';
10
11
    /**
12
     * @return string
13
     */
14
    public function getNamespace(): string
15
    {
16
        return $this->getAppNamespace() . 'Http\\Controllers\\Admin';
17
    }
18
19
    /**
20
     * @return string
21
     */
22
    public function getClassName(): string
23
    {
24
        return ucfirst($this->entity) . 'CrudController';
25
    }
26
27
    /**
28
     * @return string
29
     */
30
    public function getFileName(): string
31
    {
32
        return $this->getClassName() . '.php';
33
    }
34
35
    /**
36
     * @return string
37
     */
38
    public function getPath(): string
39
    {
40
        return app_path($this->path);
41
    }
42
43
    /**
44
     * @return string
45
     */
46
    public function getRelativeFilePath(): string
47
    {
48
        return str_replace("\\", '/', $this->getAppNamespace()).$this->path.'/'.$this->getFileName();
49
    }
50
51
    /**
52
     * @return string
53
     */
54
    public function getStub(): string
55
    {
56
        return __DIR__ . '/../../../stubs/crud-controller.stub';
57
    }
58
}
59

src/Schemas/Naming/CrudModel.php 1 location

@@ 7-58 (lines=52) @@
4
5
use Webfactor\Laravel\Generators\Contracts\NamingAbstract;
6
7
class CrudModel extends NamingAbstract
8
{
9
    private $path = 'Models';
10
11
    /**
12
     * @return string
13
     */
14
    public function getNamespace(): string
15
    {
16
        return $this->getAppNamespace() . 'Models';
17
    }
18
19
    /**
20
     * @return string
21
     */
22
    public function getClassName(): string
23
    {
24
        return ucfirst($this->entity);
25
    }
26
27
    /**
28
     * @return string
29
     */
30
    public function getFileName(): string
31
    {
32
        return $this->getClassName() . '.php';
33
    }
34
35
    /**
36
     * @return string
37
     */
38
    public function getPath(): string
39
    {
40
        return app_path($this->path);
41
    }
42
43
    /**
44
     * @return string
45
     */
46
    public function getRelativeFilePath(): string
47
    {
48
        return str_replace("\\", '/', $this->getAppNamespace()).$this->path.'/'.$this->getFileName();
49
    }
50
51
    /**
52
     * @return string
53
     */
54
    public function getStub(): string
55
    {
56
        return __DIR__ . '/../../../stubs/crud-model.stub';
57
    }
58
}
59

src/Schemas/Naming/CrudRequest.php 1 location

@@ 7-58 (lines=52) @@
4
5
use Webfactor\Laravel\Generators\Contracts\NamingAbstract;
6
7
class CrudRequest extends NamingAbstract
8
{
9
    private $path = 'Http/Requests/Admin';
10
11
    /**
12
     * @return string
13
     */
14
    public function getNamespace(): string
15
    {
16
        return $this->getAppNamespace() . 'Http\\Requests\\Admin';
17
    }
18
19
    /**
20
     * @return string
21
     */
22
    public function getClassName(): string
23
    {
24
        return ucfirst($this->entity) . 'Request';
25
    }
26
27
    /**
28
     * @return string
29
     */
30
    public function getFileName(): string
31
    {
32
        return $this->getClassName() . '.php';
33
    }
34
35
    /**
36
     * @return string
37
     */
38
    public function getPath(): string
39
    {
40
        return app_path($this->path);
41
    }
42
43
    /**
44
     * @return string
45
     */
46
    public function getRelativeFilePath(): string
47
    {
48
        return str_replace("\\", '/', $this->getAppNamespace()).$this->path.'/'.$this->getFileName();
49
    }
50
51
    /**
52
     * @return string
53
     */
54
    public function getStub(): string
55
    {
56
        return __DIR__ . '/../../../stubs/crud-request.stub';
57
    }
58
}
59