CrudModel   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 52
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 6
lcom 1
cbo 1
dl 52
loc 52
ccs 0
cts 24
cp 0
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A getNamespace() 4 4 1
A getClassName() 4 4 1
A getFileName() 4 4 1
A getPath() 4 4 1
A getRelativeFilePath() 4 4 1
A getStub() 4 4 1

How to fix   Duplicated Code   

Duplicated Code

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
2
3
namespace Webfactor\Laravel\Generators\Schemas\Naming;
4
5
use Webfactor\Laravel\Generators\Contracts\NamingAbstract;
6
7 View Code Duplication
class CrudModel extends NamingAbstract
0 ignored issues
show
Duplication introduced by
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...
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