Livestreaming   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 66
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 16
c 1
b 0
f 1
dl 0
loc 66
rs 10
wmc 5

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 26 3
A getId() 0 3 1
A setId() 0 3 1
1
<?php declare(strict_types=1);
2
3
namespace One\Model;
4
5
use One\Collection;
6
7
class Livestreaming 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 $desc
22
     * @param string $urlLive
23
     * @param string $urlThumbnail
24
     * @param \DateTimeInterface|string $publishedAt
25
     * @param \DateTimeInterface|string $endAt
26
     * @param bool $publishStatus
27
     
28
     */
29
30
    public function __construct(
31
        string $uniqueId,
32
        string $title,
33
        string $desc,
34
        string $urlLive,
35
        string $urlThumbnail,
36
        $publishedAt = null,
37
        $endAt = null,
38
        $publishStatus = false,
39
        $identifier = null
40
    ) {
41
        $properties = [
42
            'title' => $this->filterStringInstance($title),
43
            'desc' => $this->filterStringInstance($desc),
44
            'url_live' => $this->filterStringInstance($urlLive),
45
            'url_thumbnail' => $this->filterStringInstance($urlThumbnail),
46
            'published_at' => $this->filterDateInstance($publishedAt),
47
            'end_at' => $this->filterDateInstance($endAt),
48
            'publish_status' => $publishStatus ? 1 : 0,
49
            'uniqueId' => $uniqueId
50
        ];
51
52
        $this->collection = new Collection($properties);
53
54
        if ($identifier) {
55
            $this->setId((string) $identifier);
56
        }
57
    }
58
59
    /**
60
     * setIdentifier from rest api response
61
     */
62
    public function setId(string $identifier): void
63
    {
64
        $this->identifier = $identifier;
65
    }
66
67
    /**
68
     * getIdentifier set before
69
     */
70
    public function getId(): string
71
    {
72
        return $this->identifier;
73
    }
74
}
75
76