AccountInformation   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 45
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 2
dl 45
loc 45
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 7 7 1
A getLoyaltyTitle() 4 4 1
A getCreated() 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\Character;
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 AccountInformation
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 $loyaltyTitle;
18
19
    /**
20
     * @var Carbon
21
     */
22
    private $created;
23
24
    /**
25
     * AccountInformation constructor.
26
     *
27
     * @param  string  $loyaltyTitle
28
     * @param  Carbon  $created
29
     * @throws ImmutableException
30
     */
31
    public function __construct(string $loyaltyTitle, Carbon $created)
32
    {
33
        $this->handleImmutableConstructor();
34
35
        $this->loyaltyTitle = $loyaltyTitle;
36
        $this->created = $created;
37
    }
38
39
    /**
40
     * @return string
41
     */
42
    public function getLoyaltyTitle(): string
43
    {
44
        return $this->loyaltyTitle;
45
    }
46
47
    /**
48
     * @return Carbon
49
     */
50
    public function getCreated(): Carbon
51
    {
52
        return $this->created;
53
    }
54
}
55