News::getDate()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 4
Ratio 100 %

Importance

Changes 0
Metric Value
dl 4
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Igorsgm\TibiaDataApi\Models;
4
5
use Carbon\Carbon;
6
use Igorsgm\TibiaDataApi\Exceptions\ImmutableException;
7
use Igorsgm\TibiaDataApi\Traits\ImmutableTrait;
8
use Igorsgm\TibiaDataApi\Traits\SerializableTrait;
9
10 View Code Duplication
class News
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 int
16
     */
17
    private $id;
18
19
    /**
20
     * @var string
21
     */
22
    private $title;
23
24
    /**
25
     * @var string
26
     */
27
    private $content;
28
29
    /**
30
     * @var Carbon
31
     */
32
    private $date;
33
34
    /**
35
     * News constructor.
36
     * @param  int  $id
37
     * @param  string  $title
38
     * @param  string  $content
39
     * @param  Carbon  $date
40
     * @throws ImmutableException
41
     */
42
    public function __construct(int $id, string $title, string $content, Carbon $date)
43
    {
44
        $this->handleImmutableConstructor();
45
46
        $this->id = $id;
47
        $this->title = $title;
48
        $this->content = $content;
49
        $this->date = $date;
50
    }
51
52
    /**
53
     * @return int
54
     */
55
    public function getId(): int
56
    {
57
        return $this->id;
58
    }
59
60
    /**
61
     * @return string
62
     */
63
    public function getTitle(): string
64
    {
65
        return $this->title;
66
    }
67
68
    /**
69
     * @return string
70
     */
71
    public function getContent(): string
72
    {
73
        return $this->content;
74
    }
75
76
    /**
77
     * @return Carbon
78
     */
79
    public function getDate(): Carbon
80
    {
81
        return $this->date;
82
    }
83
}
84