Newslist::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7

Duplication

Lines 7
Ratio 100 %

Importance

Changes 0
Metric Value
dl 7
loc 7
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
1
<?php
2
3
namespace Igorsgm\TibiaDataApi\Models;
4
5
use Igorsgm\TibiaDataApi\Traits\ImmutableTrait;
6
use Igorsgm\TibiaDataApi\Traits\SerializableTrait;
7
use Illuminate\Support\Collection;
8
9 View Code Duplication
class Newslist
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 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