Character   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 111
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 7
lcom 0
cbo 2
dl 111
loc 111
rs 10
c 0
b 0
f 0

7 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 17 17 1
A getName() 4 4 1
A getNick() 4 4 1
A getLevel() 4 4 1
A getVocation() 4 4 1
A getJoined() 4 4 1
A getStatus() 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 Igorsgm\TibiaDataApi\Models\Guild;
4
5
use Carbon\Carbon;
6
use Igorsgm\TibiaDataApi\Exceptions\ImmutableException;
7
use Igorsgm\TibiaDataApi\Traits\ImmutableTrait;
8
use Igorsgm\TibiaDataApi\Traits\SerializableTrait;
9
10 View Code Duplication
class Character
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...
11
{
12
    use ImmutableTrait, SerializableTrait;
13
14
    /**
15
     * @var string
16
     */
17
    private $name;
18
19
    /**
20
     * @var string
21
     */
22
    private $nick;
23
24
    /**
25
     * @var int
26
     */
27
    private $level;
28
29
    /**
30
     * @var string
31
     */
32
    private $vocation;
33
34
    /**
35
     * @var Carbon
36
     */
37
    private $joined;
38
39
    /**
40
     * @var string
41
     */
42
    private $status;
43
44
    /**
45
     * Character constructor.
46
     *
47
     * @param  string  $name
48
     * @param  string  $nick
49
     * @param  int  $level
50
     * @param  string  $vocation
51
     * @param  Carbon  $joined
52
     * @param  string  $status
53
     * @throws ImmutableException
54
     */
55
    public function __construct(
56
        string $name,
57
        string $nick,
58
        int $level,
59
        string $vocation,
60
        Carbon $joined,
61
        string $status
62
    ) {
63
        $this->handleImmutableConstructor();
64
65
        $this->name = $name;
66
        $this->nick = $nick;
67
        $this->level = $level;
68
        $this->vocation = $vocation;
69
        $this->joined = $joined;
70
        $this->status = $status;
71
    }
72
73
    /**
74
     * @return string
75
     */
76
    public function getName(): string
77
    {
78
        return $this->name;
79
    }
80
81
    /**
82
     * @return string
83
     */
84
    public function getNick(): string
85
    {
86
        return $this->nick;
87
    }
88
89
    /**
90
     * @return int
91
     */
92
    public function getLevel(): int
93
    {
94
        return $this->level;
95
    }
96
97
    /**
98
     * @return string
99
     */
100
    public function getVocation(): string
101
    {
102
        return $this->vocation;
103
    }
104
105
    /**
106
     * @return Carbon
107
     */
108
    public function getJoined(): Carbon
109
    {
110
        return $this->joined;
111
    }
112
113
    /**
114
     * @return string
115
     */
116
    public function getStatus(): string
117
    {
118
        return $this->status;
119
    }
120
}
121