Houses   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 getTown() 4 4 1
A getWorld() 4 4 1
A getType() 4 4 1
A getHouses() 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;
4
5
use Igorsgm\TibiaDataApi\Models\Houses\House;
6
use Igorsgm\TibiaDataApi\Traits\ImmutableTrait;
7
use Igorsgm\TibiaDataApi\Traits\SerializableTrait;
8
use Illuminate\Support\Collection;
9
10 View Code Duplication
class Houses
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 $town;
18
19
    /**
20
     * @var string
21
     */
22
    private $world;
23
24
    /**
25
     * @var string
26
     */
27
    private $type;
28
29
    /**
30
     * @var Collection
31
     */
32
    private $houses;
33
34
    /**
35
     * Houses constructor.
36
     * @param  string  $town
37
     * @param  string  $world
38
     * @param  string  $type
39
     * @param  array  $houses
40
     * @throws \Igorsgm\TibiaDataApi\Exceptions\ImmutableException
41
     */
42
    public function __construct(string $town, string $world, string $type, Collection $houses)
43
    {
44
        $this->handleImmutableConstructor();
45
46
        $this->town = $town;
47
        $this->world = $world;
48
        $this->type = $type;
49
        $this->houses = $houses;
50
    }
51
52
    /**
53
     * @return string
54
     */
55
    public function getTown(): string
56
    {
57
        return $this->town;
58
    }
59
60
    /**
61
     * @return string
62
     */
63
    public function getWorld(): string
64
    {
65
        return $this->world;
66
    }
67
68
    /**
69
     * @return string
70
     */
71
    public function getType(): string
72
    {
73
        return $this->type;
74
    }
75
76
    /**
77
     * @return House[]
78
     */
79
    public function getHouses(): Collection
80
    {
81
        return $this->houses;
82
    }
83
}
84