Guild   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 74
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 5
lcom 0
cbo 2
dl 74
loc 74
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 9 9 1
A getName() 4 4 1
A getDescription() 4 4 1
A getLogoUrl() 4 4 1
A isActive() 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\Guilds;
4
5
use Igorsgm\TibiaDataApi\Exceptions\ImmutableException;
6
use Igorsgm\TibiaDataApi\Traits\ImmutableTrait;
7
use Igorsgm\TibiaDataApi\Traits\SerializableTrait;
8
9 View Code Duplication
class Guild
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...
10
{
11
    use ImmutableTrait, SerializableTrait;
12
13
    /**
14
     * @var string
15
     */
16
    private $name;
17
18
    /**
19
     * @var string
20
     */
21
    private $description;
22
23
    /**
24
     * @var string
25
     */
26
    private $logoUrl;
27
28
    /**
29
     * @var bool
30
     */
31
    private $isActive;
32
33
    /**
34
     * Guild constructor.
35
     * @param  string  $name
36
     * @param  string  $description
37
     * @param  string  $logoUrl
38
     * @param  bool  $isActive
39
     * @throws ImmutableException
40
     */
41
    public function __construct(string $name, string $description, string $logoUrl, bool $isActive)
42
    {
43
        $this->handleImmutableConstructor();
44
45
        $this->name = $name;
46
        $this->description = $description;
47
        $this->logoUrl = $logoUrl;
48
        $this->isActive = $isActive;
49
    }
50
51
    /**
52
     * @return string
53
     */
54
    public function getName(): string
55
    {
56
        return $this->name;
57
    }
58
59
    /**
60
     * @return string
61
     */
62
    public function getDescription(): string
63
    {
64
        return $this->description;
65
    }
66
67
    /**
68
     * @return string
69
     */
70
    public function getLogoUrl(): string
71
    {
72
        return $this->logoUrl;
73
    }
74
75
    /**
76
     * @return bool
77
     */
78
    public function isActive(): bool
79
    {
80
        return $this->isActive;
81
    }
82
}
83