House   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 97
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

7 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 10 10 1
A getHouseId() 4 4 1
A getName() 4 4 1
A getSize() 4 4 1
A getRent() 4 4 1
A getStatus() 4 4 1
A isRented() 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\Houses;
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 House
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 int
15
     */
16
    private $houseId;
17
18
    /**
19
     * @var string
20
     */
21
    private $name;
22
23
    /**
24
     * @var int
25
     */
26
    private $size;
27
28
    /**
29
     * @var int
30
     */
31
    private $rent;
32
33
    /**
34
     * @var string
35
     */
36
    private $status;
37
38
    /**
39
     * House constructor.
40
     * @param  int  $id
41
     * @param  string  $name
42
     * @param  int  $size
43
     * @param  int  $rent
44
     * @param  string  $status
45
     * @throws ImmutableException
46
     */
47
    public function __construct(int $id, string $name, int $size, int $rent, string $status)
48
    {
49
        $this->handleImmutableConstructor();
50
51
        $this->houseId = $id;
52
        $this->name = $name;
53
        $this->size = $size;
54
        $this->rent = $rent;
55
        $this->status = $status;
56
    }
57
58
    /**
59
     * @return int
60
     */
61
    public function getHouseId(): int
62
    {
63
        return $this->houseId;
64
    }
65
66
    /**
67
     * @return string
68
     */
69
    public function getName(): string
70
    {
71
        return $this->name;
72
    }
73
74
    /**
75
     * @return int
76
     */
77
    public function getSize(): int
78
    {
79
        return $this->size;
80
    }
81
82
    /**
83
     * @return int
84
     */
85
    public function getRent(): int
86
    {
87
        return $this->rent;
88
    }
89
90
    /**
91
     * @return string
92
     */
93
    public function getStatus(): string
94
    {
95
        return $this->status;
96
    }
97
98
    /**
99
     * @return bool
100
     */
101
    public function isRented()
102
    {
103
        return $this->status === 'rented';
104
    }
105
}
106