Passed
Push — feature/786_podcasts ( f026ee )
by Pauli
11:46
created

PodcastEpisode::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 4
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 5
rs 10
1
<?php declare(strict_types=1);
2
3
/**
4
 * ownCloud - Music app
5
 *
6
 * This file is licensed under the Affero General Public License version 3 or
7
 * later. See the COPYING file.
8
 *
9
 * @author Pauli Järvinen <[email protected]>
10
 * @copyright Pauli Järvinen 2021
11
 */
12
13
namespace OCA\Music\Db;
14
15
use \OCP\AppFramework\Db\Entity;
16
17
/**
18
 * @method string getUserId()
19
 * @method void setUserId(string $userId)
20
 * @method int getChannelId()
21
 * @method void setChannelId(int $id)
22
 * @method string getStreamUrl()
23
 * @method setStreamUrl(string $url)
24
 * @method string getMimetype()
25
 * @method setMimetype(string $mime)
26
 * @method int getSize()
27
 * @method void setSize(int $size)
28
 * @method int getDuration()
29
 * @method void setDuration(int $duration)
30
 * @method string getGuid()
31
 * @method void setGuid(string $guid)
32
 * @method string getGuidHash()
33
 * @method void setGuidHash(string $guidHash)
34
 * @method string getTitle()
35
 * @method void setTitle(string $title)
36
 * @method int getEpisode()
37
 * @method void setEpisode(int $episode)
38
 * @method string getLinkUrl()
39
 * @method void setLinkUrl(string $url)
40
 * @method string getPublished()
41
 * @method void setPublished(string $timestamp)
42
 * @method string getKeywords()
43
 * @method void setKeywords(string $keywords)
44
 * @method string getCopyright()
45
 * @method void setCopyright(string $copyright)
46
 * @method string getAuthor()
47
 * @method void setAuthor(string $author)
48
 * @method string getDescription()
49
 * @method void setDescription(string $description)
50
 * @method string getCreated()
51
 * @method void setCreated(string $timestamp)
52
 * @method string getUpdated()
53
 * @method void setUpdated(string $timestamp)
54
 */
55
class PodcastEpisode extends Entity {
56
	public $userId;
57
	public $channelId;
58
	public $streamUrl;
59
	public $mimetype;
60
	public $size;
61
	public $duration;
62
	public $guid;
63
	public $guidHash;
64
	public $title;
65
	public $episode;
66
	public $linkUrl;
67
	public $published;
68
	public $keywords;
69
	public $copyright;
70
	public $author;
71
	public $description;
72
	public $created;
73
	public $updated;
74
	
75
	public function __construct() {
76
		$this->addType('channelId', 'int');
77
		$this->addType('size', 'int');
78
		$this->addType('duration', 'int');
79
		$this->addType('episode', 'int');
80
	}
81
82
	public function toApi() : array {
83
		return [
84
			'id' => $this->getId(),
85
			'title' => $this->getTitle(),
86
			'stream_url' => $this->getStreamUrl(),
87
			'mimetype' => $this->getMimetype()
88
		];
89
	}
90
}
91