Guild   A
last analyzed

Complexity

Total Complexity 19

Size/Duplication

Total Lines 268
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

19 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 1
A createFromArray() 0 21 1
A getName() 0 4 1
A getDescription() 0 4 1
A getGuildhall() 0 4 1
A isApplication() 0 4 1
A isWar() 0 4 1
A getOnlineStatus() 0 4 1
A getOfflineStatus() 0 4 1
A isDisbanded() 0 4 1
A getTotalMembers() 0 4 1
A getTotalInvited() 0 4 1
A getWorld() 0 4 1
A getFounded() 0 4 1
A isActive() 0 4 1
A getHomepage() 0 4 1
A getGuildLogo() 0 4 1
A getMembers() 0 4 1
A getInvited() 0 4 1
1
<?php
2
3
namespace Igorsgm\TibiaDataApi\Models;
4
5
use Carbon\Carbon;
6
use Igorsgm\TibiaDataApi\Exceptions\ImmutableException;
7
use Igorsgm\TibiaDataApi\Models\Guild\Guildhall;
8
use Igorsgm\TibiaDataApi\Models\Guild\Invited;
9
use Igorsgm\TibiaDataApi\Models\Guild\Members;
10
use Igorsgm\TibiaDataApi\Traits\ImmutableTrait;
11
use Igorsgm\TibiaDataApi\Traits\SerializableTrait;
12
13
class Guild
14
{
15
    use ImmutableTrait, SerializableTrait;
16
17
    /**
18
     * @var string
19
     */
20
    private $name;
21
22
    /**
23
     * @var string
24
     */
25
    private $description;
26
27
    /**
28
     * @var Guildhall
29
     */
30
    private $guildhall;
31
32
    /**
33
     * @var boolean
34
     */
35
    private $application;
36
37
    /**
38
     * @var boolean
39
     */
40
    private $war;
41
42
    /**
43
     * @var integer
44
     */
45
    private $onlineStatus;
46
47
    /**
48
     * @var integer
49
     */
50
    private $offlineStatus;
51
52
    /**
53
     * @var boolean
54
     */
55
    private $disbanded;
56
57
    /**
58
     * @var integer
59
     */
60
    private $totalMembers;
61
62
    /**
63
     * @var integer
64
     */
65
    private $totalInvited;
66
67
    /**
68
     * @var string
69
     */
70
    private $world;
71
72
    /**
73
     * @var Carbon
74
     */
75
    private $founded;
76
77
    /**
78
     * @var boolean
79
     */
80
    private $active;
81
82
    /**
83
     * @var string
84
     */
85
    private $homepage;
86
87
    /**
88
     * @var string
89
     */
90
    private $guildLogo;
91
92
    /**
93
     * @var Members[]
94
     */
95
    private $members;
96
97
    /**
98
     * @var Invited
99
     */
100
    private $invited;
101
102
    /**
103
     * Guild constructor.
104
     * @param  string  $name
105
     * @param  string  $description
106
     * @param  string  $world
107
     * @throws ImmutableException
108
     */
109
    public function __construct(string $name, string $description, string $world)
110
    {
111
        $this->handleImmutableConstructor();
112
113
        $this->name = $name;
114
        $this->description = $description;
115
        $this->world = $world;
116
    }
117
118
    /**
119
     * @param  array  $array
120
     * @return Guild
121
     * @throws ImmutableException
122
     */
123
    public static function createFromArray(array $array): Guild
124
    {
125
        $guild = new Guild($array['name'], $array['description'], $array['world']);
126
127
        $guild->guildhall = $array['guildhall'];
128
        $guild->application = $array['application'];
129
        $guild->war = $array['war'];
130
        $guild->onlineStatus = $array['online_status'];
131
        $guild->offlineStatus = $array['offline_status'];
132
        $guild->disbanded = $array['disbanded'];
133
        $guild->totalMembers = $array['totalmembers'];
134
        $guild->totalInvited = $array['totalinvited'];
135
        $guild->founded = $array['founded'];
136
        $guild->active = $array['active'];
137
        $guild->homepage = $array['homepage'];
138
        $guild->guildLogo = $array['guildlogo'];
139
        $guild->members = $array['members'];
140
        $guild->invited = $array['invited'];
141
142
        return $guild;
143
    }
144
145
    /**
146
     * @return string
147
     */
148
    public function getName(): string
149
    {
150
        return $this->name;
151
    }
152
153
    /**
154
     * @return string
155
     */
156
    public function getDescription(): string
157
    {
158
        return $this->description;
159
    }
160
161
    /**
162
     * @return Guildhall|null
163
     */
164
    public function getGuildhall(): ?Guildhall
165
    {
166
        return $this->guildhall;
167
    }
168
169
    /**
170
     * @return bool
171
     */
172
    public function isApplication(): bool
173
    {
174
        return $this->application;
175
    }
176
177
    /**
178
     * @return bool
179
     */
180
    public function isWar(): bool
181
    {
182
        return $this->war;
183
    }
184
185
    /**
186
     * @return int
187
     */
188
    public function getOnlineStatus(): int
189
    {
190
        return $this->onlineStatus;
191
    }
192
193
    /**
194
     * @return int
195
     */
196
    public function getOfflineStatus(): int
197
    {
198
        return $this->offlineStatus;
199
    }
200
201
    /**
202
     * @return bool
203
     */
204
    public function isDisbanded(): bool
205
    {
206
        return $this->disbanded;
207
    }
208
209
    /**
210
     * @return int
211
     */
212
    public function getTotalMembers(): int
213
    {
214
        return $this->totalMembers;
215
    }
216
217
    /**
218
     * @return int
219
     */
220
    public function getTotalInvited(): int
221
    {
222
        return $this->totalInvited;
223
    }
224
225
    /**
226
     * @return string
227
     */
228
    public function getWorld(): string
229
    {
230
        return $this->world;
231
    }
232
233
    /**
234
     * @return Carbon
235
     */
236
    public function getFounded(): Carbon
237
    {
238
        return $this->founded;
239
    }
240
241
    /**
242
     * @return bool
243
     */
244
    public function isActive(): bool
245
    {
246
        return $this->active;
247
    }
248
249
    /**
250
     * @return string
251
     */
252
    public function getHomepage(): string
253
    {
254
        return $this->homepage;
255
    }
256
257
    /**
258
     * @return string
259
     */
260
    public function getGuildLogo(): string
261
    {
262
        return $this->guildLogo;
263
    }
264
265
    /**
266
     * @return Members[]
267
     */
268
    public function getMembers()
269
    {
270
        return $this->members;
271
    }
272
273
    /**
274
     * @return Invited
275
     */
276
    public function getInvited(): Invited
277
    {
278
        return $this->invited;
279
    }
280
}
281