Source of file Video.php

Size: 4,221 Bytes - Last Modified: 2017-06-15T21:51:07+02:00

C:/xampp/htdocs/PodTube/src/classes/Video.php

123456789101112131415161718192021222324252627282930313233343536373839404142
Covered by 1 test(s):
  • VideoTest::testGettersAndSetters
434445464748495051
Covered by 1 test(s):
  • VideoTest::testGettersAndSetters
52
Covered by 1 test(s):
  • VideoTest::testGettersAndSetters
5354555657585960
Covered by 1 test(s):
  • VideoTest::testGettersAndSetters
616263646566676869
Covered by 1 test(s):
  • VideoTest::testGettersAndSetters
70
Covered by 1 test(s):
  • VideoTest::testGettersAndSetters
7172737475767778
Covered by 1 test(s):
  • VideoTest::testGettersAndSetters
798081828384858687
Covered by 1 test(s):
  • VideoTest::testGettersAndSetters
88
Covered by 1 test(s):
  • VideoTest::testGettersAndSetters
8990919293949596
Covered by 1 test(s):
  • VideoTest::testGettersAndSetters
979899100101102103104105
Covered by 1 test(s):
  • VideoTest::testGettersAndSetters
106
Covered by 1 test(s):
  • VideoTest::testGettersAndSetters
107108109110111112113114
Covered by 1 test(s):
  • VideoTest::testGettersAndSetters
115
Covered by 1 test(s):
  • VideoTest::testGettersAndSetters
116117118
Covered by 1 test(s):
  • VideoTest::testGettersAndSetters
119120121122123124125126127
Covered by 1 test(s):
  • VideoTest::testGettersAndSetters
128
Covered by 1 test(s):
  • VideoTest::testGettersAndSetters
129130131132133134135136
Covered by 1 test(s):
  • VideoTest::testGettersAndSetters
137138139140141142143144145
Covered by 1 test(s):
  • VideoTest::testGettersAndSetters
146
Covered by 1 test(s):
  • VideoTest::testGettersAndSetters
147148149150151152153154
Covered by 1 test(s):
  • VideoTest::testGettersAndSetters
155156157158159160161162163
Covered by 1 test(s):
  • VideoTest::testGettersAndSetters
164
Covered by 1 test(s):
  • VideoTest::testGettersAndSetters
165166167168169170
Covered by 1 test(s):
  • VideoTest::testGettersAndSetters
171172173174175176177
Covered by 1 test(s):
  • VideoTest::testGettersAndSetters
178
Covered by 1 test(s):
  • VideoTest::testGettersAndSetters
179180181182183184
Covered by 1 test(s):
  • VideoTest::testGettersAndSetters
185186187188189190191
Covered by 1 test(s):
  • VideoTest::testGettersAndSetters
192
Covered by 1 test(s):
  • VideoTest::testGettersAndSetters
193194195196197198
Covered by 1 test(s):
  • VideoTest::testGettersAndSetters
199200201202203204205
Covered by 1 test(s):
  • VideoTest::testGettersAndSetters
206
Covered by 1 test(s):
  • VideoTest::testGettersAndSetters
207208209210211212
Covered by 1 test(s):
  • VideoTest::testGettersAndSetters
213214215216217218219
Covered by 1 test(s):
  • VideoTest::testGettersAndSetters
220
Covered by 1 test(s):
  • VideoTest::testGettersAndSetters
221
Covered by 1 test(s):
  • VideoTest::testGettersAndSetters
222223224
Covered by 1 test(s):
  • VideoTest::testGettersAndSetters
225226
Covered by 1 test(s):
  • VideoTest::testGettersAndSetters
227228229230231232
Covered by 1 test(s):
  • VideoTest::testGettersAndSetters
233234235236
<?php

namespace AudioDidact;
require_once __DIR__ . "/../header.php";

/**
 * Class Video
 * Stores YouTube video specific data
 */
class Video {
	/** @var string YouTube video ID */
	private $id;
	/** @var string video title */
	private $title;
	/** @var string video description (UTF-8) */
	private $desc;
	/** @var string date and time video was added to the feed */
	private $time;
	/** @var int the duration in seconds of the video */
	private $duration;
	/** @var string video author or channel */
	private $author;
	/** @var int order of this video in the feed */
	private $order;
	/** @var string url of video page */
	private $url;
	/** @var boolean $isVideo True if this video should be added to a feed as video (not audio only) */
	private $isVideo;
	/** @var string $thumbnailFilename filename with extension of thumbnail */
	private $thumbnailFilename;
	/** @var string $filename filename of the audio/video file without extension */
	private $filename;
	/** @var string $fileExtension extension of the audio or video file with preceeding period (.) */
	private $fileExtension;

	/**
	 * Gets the YouTube video ID
	 *
	 * @return mixed
	 */
	public function getId(){
		return $this->id;
	}

	/**
	 * Sets the YouTube video ID
	 *
	 * @param mixed $id
	 */
	public function setId($id){
		$this->id = $id;
	}

	/**
	 * Gets the video title
	 *
	 * @return mixed
	 */
	public function getTitle(){
		return $this->title;
	}

	/**
	 * Sets the video title
	 *
	 * @param mixed $title
	 */
	public function setTitle($title){
		$this->title = $title;
	}

	/**
	 * Gets the video description
	 *
	 * @return mixed
	 */
	public function getDesc(){
		return $this->desc;
	}

	/**
	 * Sets the video description
	 *
	 * @param mixed $desc
	 */
	public function setDesc($desc){
		$this->desc = $desc;
	}

	/**
	 * Gets the time the video was added
	 *
	 * @return mixed
	 */
	public function getTime(){
		return $this->time;
	}

	/**
	 * Sets the time the video was added
	 *
	 * @param mixed $time
	 */
	public function setTime($time){
		$this->time = $time;
	}

	/**
	 * Gets the duration of the video in seconds
	 *
	 * @return mixed
	 */
	public function getDuration(){
		if($this->duration == null){
			return 0;
		}

		return $this->duration;
	}

	/**
	 * Sets the duration of the video in seconds
	 *
	 * @param mixed $duration
	 */
	public function setDuration($duration){
		$this->duration = $duration;
	}

	/**
	 * Gets the video author
	 *
	 * @return mixed
	 */
	public function getAuthor(){
		return $this->author;
	}

	/**
	 * Sets the video author
	 *
	 * @param mixed $author
	 */
	public function setAuthor($author){
		$this->author = $author;
	}

	/**
	 * Gets the order of the video in the feed
	 *
	 * @return int
	 */
	public function getOrder(){
		return $this->order;
	}

	/**
	 * Sets the order of the video in the feed
	 *
	 * @param int $order
	 */
	public function setOrder($order){
		$this->order = $order;
	}

	/**
	 * @return string
	 */
	public function getURL(){
		return $this->url;
	}

	/**
	 * @param string $url
	 */
	public function setURL($url){
		$this->url = $url;
	}

	/**
	 * @return bool
	 */
	public function isIsVideo(){
		return $this->isVideo;
	}

	/**
	 * @param bool $isVideo
	 */
	public function setIsVideo($isVideo){
		$this->isVideo = $isVideo;
	}

	/**
	 * @return string
	 */
	public function getThumbnailFilename(){
		return $this->thumbnailFilename;
	}

	/**
	 * @param string $thumbnailFilename
	 */
	public function setThumbnailFilename($thumbnailFilename){
		$this->thumbnailFilename = $thumbnailFilename;
	}

	/**
	 * @return string
	 */
	public function getFilename(){
		return $this->filename;
	}

	/**
	 * @param string $filename
	 */
	public function setFilename($filename){
		$this->filename = $filename;
		if($this->isVideo){
			$this->fileExtension = ".mp4";
		}
		else{
			$this->fileExtension = ".mp3";
		}
	}

	/**
	 * @return string
	 */
	public function getFileExtension(){
		return $this->fileExtension;
	}

}