@@ 9-45 (lines=37) @@ | ||
6 | use Igorsgm\TibiaDataApi\Traits\SerializableTrait; |
|
7 | use Illuminate\Support\Collection; |
|
8 | ||
9 | class Newslist |
|
10 | { |
|
11 | use ImmutableTrait, SerializableTrait; |
|
12 | ||
13 | /** |
|
14 | * @var string |
|
15 | */ |
|
16 | private $type; |
|
17 | ||
18 | /** |
|
19 | * @var Collection |
|
20 | */ |
|
21 | private $news; |
|
22 | ||
23 | /** |
|
24 | * Newslist constructor. |
|
25 | * |
|
26 | * @param string $type |
|
27 | * @param array $news |
|
28 | * @throws \Igorsgm\TibiaDataApi\Exceptions\ImmutableException |
|
29 | */ |
|
30 | public function __construct(string $type, Collection $news) |
|
31 | { |
|
32 | $this->handleImmutableConstructor(); |
|
33 | ||
34 | $this->type = $type; |
|
35 | $this->news = $news; |
|
36 | } |
|
37 | ||
38 | /** |
|
39 | * @return News[] |
|
40 | */ |
|
41 | public function getNews(): Collection |
|
42 | { |
|
43 | return $this->news; |
|
44 | } |
|
45 | } |
|
46 |
@@ 10-53 (lines=44) @@ | ||
7 | use Igorsgm\TibiaDataApi\Traits\SerializableTrait; |
|
8 | use Illuminate\Support\Collection; |
|
9 | ||
10 | class Worlds |
|
11 | { |
|
12 | use ImmutableTrait, SerializableTrait; |
|
13 | ||
14 | /** |
|
15 | * @var int |
|
16 | */ |
|
17 | private $online; |
|
18 | ||
19 | /** |
|
20 | * @var array |
|
21 | */ |
|
22 | private $worlds; |
|
23 | ||
24 | /** |
|
25 | * Worlds constructor. |
|
26 | * @param int $online |
|
27 | * @param array $worlds |
|
28 | * @throws \Igorsgm\TibiaDataApi\Exceptions\ImmutableException |
|
29 | */ |
|
30 | public function __construct(int $online, Collection $worlds) |
|
31 | { |
|
32 | $this->handleImmutableConstructor(); |
|
33 | ||
34 | $this->online = $online; |
|
35 | $this->worlds = $worlds; |
|
36 | } |
|
37 | ||
38 | /** |
|
39 | * @return int |
|
40 | */ |
|
41 | public function getOnline(): int |
|
42 | { |
|
43 | return $this->online; |
|
44 | } |
|
45 | ||
46 | /** |
|
47 | * @return World[] |
|
48 | */ |
|
49 | public function getWorlds(): Collection |
|
50 | { |
|
51 | return $this->worlds; |
|
52 | } |
|
53 | } |
|
54 |