Passed
Push — master ( 1ba277...ff87af )
by
unknown
03:35
created

Livereport::setId()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 3
rs 10
1
<?php declare(strict_types=1);
2
3
namespace One\Model;
4
5
use One\Collection;
6
7
class Livereport extends Model
8
{
9
    /**
10
     * identifier
11
     *
12
     * @var string
13
     */
14
    protected $identifier = null;
15
16
    /**
17
     * constuctor
18
     *
19
     * @param string $uniqueId
20
     * @param string $title
21
     * @param string $shortDesc
22
     * @param \DateTimeInterface|string $publishDat
23
     * @param \DateTimeInterface|string $endDate
24
     * @param string $tag
25
     * @param bool $isHeadline
26
     * @param bool $published
27
     * @param string $livereportChild
28
     
29
     */
30
31
    public function __construct(
32
        string $uniqueId,
33
        string $title,
34
        string $shortDesc,
35
        $publishDate = null,
36
        $endDate = null,
37
        string $tag = null,
38
        $isHeadline = false,
39
        $published = false,
40
        string $livereportChild = null,
41
        $identifier = null
42
43
    ) {
44
        $properties = [
45
            'title' => $this->filterStringInstance($title),
46
            'short_desc' => $this->filterStringInstance($desc),
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $desc seems to be never defined.
Loading history...
47
            'publish_date' => $this->filterDateInstance($publishDate),
48
            'end_date' => $this->filterDateInstance($endDate),
49
            'tag' => $this->filterStringInstance($tag),
50
            'is_headline' => $isHeadline ? 1 : 0,
51
            'published' => $published ? 1 : 0,
52
            'livereport_child' => $this->filterStringInstance($livereportChild)
53
        ];
54
55
        $this->collection = new Collection($properties);
56
57
        if ($identifier) {
58
            $this->setId((string) $identifier);
59
        }
60
    }
61
62
    /**
63
     * setIdentifier from rest api response
64
     */
65
    public function setId(string $identifier): void
66
    {
67
        $this->identifier = $identifier;
68
    }
69
70
    /**
71
     * getIdentifier set before
72
     */
73
    public function getId(): string
74
    {
75
        return $this->identifier;
76
    }
77
}
78
79