/modules/Tmdb/Model/Tv.php

https://gitlab.com/x33n/ampache · PHP · 817 lines · 356 code · 126 blank · 335 comment · 2 complexity · a2abe59d927796e43a4789b5f03b38c7 MD5 · raw file

  1. <?php
  2. /**
  3. * This file is part of the Tmdb PHP API created by Michael Roterman.
  4. *
  5. * For the full copyright and license information, please view the LICENSE
  6. * file that was distributed with this source code.
  7. *
  8. * @package Tmdb
  9. * @author Michael Roterman <michael@wtfz.net>
  10. * @copyright (c) 2013, Michael Roterman
  11. * @version 0.0.1
  12. */
  13. namespace Tmdb\Model;
  14. use Tmdb\Model\Collection\Videos;
  15. use Tmdb\Model\Common\GenericCollection;
  16. use Tmdb\Model\Collection\CreditsCollection;
  17. use Tmdb\Model\Collection\Genres;
  18. use Tmdb\Model\Collection\Images;
  19. use Tmdb\Model\Image\BackdropImage;
  20. use Tmdb\Model\Image\PosterImage;
  21. use Tmdb\Model\Common\ExternalIds;
  22. /**
  23. * Class Tv
  24. * @package Tmdb\Model
  25. */
  26. class Tv extends AbstractModel
  27. {
  28. /**
  29. * @var Image
  30. */
  31. private $backdropPath;
  32. /**
  33. * @var Collection
  34. */
  35. private $createdBy = null;
  36. /**
  37. * @var array
  38. */
  39. private $episodeRunTime;
  40. /**
  41. * @var \DateTime
  42. */
  43. private $firstAirDate;
  44. /**
  45. * Genres
  46. *
  47. * @var Genres
  48. */
  49. private $genres;
  50. /**
  51. * @var string
  52. */
  53. private $homepage;
  54. /**
  55. * @var int
  56. */
  57. private $id;
  58. /**
  59. * @var boolean
  60. */
  61. private $inProduction;
  62. /**
  63. * @var array
  64. */
  65. private $languages;
  66. /**
  67. * @var \DateTime
  68. */
  69. private $lastAirDate;
  70. /**
  71. * @var string
  72. */
  73. private $name;
  74. /**
  75. * @var Network[]
  76. */
  77. private $networks;
  78. /**
  79. * @var integer
  80. */
  81. private $numberOfEpisodes;
  82. /**
  83. * @var integer
  84. */
  85. private $numberOfSeasons;
  86. /**
  87. * @var string
  88. */
  89. private $originalName;
  90. /**
  91. * @var Collection
  92. */
  93. private $originCountry;
  94. /**
  95. * @var string
  96. */
  97. private $overview;
  98. /**
  99. * @var float
  100. */
  101. private $popularity;
  102. /**
  103. * @var Image
  104. */
  105. private $posterPath;
  106. /**
  107. * @var Collection
  108. */
  109. private $seasons;
  110. /**
  111. * @var string
  112. */
  113. private $status;
  114. /**
  115. * @var float
  116. */
  117. private $voteAverage;
  118. /**
  119. * @var int
  120. */
  121. private $voteCount;
  122. /**
  123. * Credits
  124. *
  125. * @var Credits
  126. */
  127. protected $credits;
  128. /**
  129. * External Ids
  130. *
  131. * @var ExternalIds
  132. */
  133. protected $externalIds;
  134. /**
  135. * Images
  136. *
  137. * @var Images
  138. */
  139. protected $images;
  140. /**
  141. * @var Collection
  142. */
  143. protected $translations;
  144. /**
  145. * @var BackdropImage
  146. */
  147. protected $backdrop;
  148. /**
  149. * @var PosterImage
  150. */
  151. protected $poster;
  152. /**
  153. * @var Videos
  154. */
  155. protected $videos;
  156. /**
  157. * Properties that are available in the API
  158. *
  159. * These properties are hydrated by the ObjectHydrator, all the other properties are handled by the factory.
  160. *
  161. * @var array
  162. */
  163. public static $properties = array(
  164. 'backdrop_path',
  165. 'created_by',
  166. 'episode_run_time',
  167. 'first_air_date',
  168. 'homepage',
  169. 'id',
  170. 'in_production',
  171. 'languages',
  172. 'last_air_date',
  173. 'name',
  174. 'number_of_episodes',
  175. 'number_of_seasons',
  176. 'original_name',
  177. 'origin_country',
  178. 'overview',
  179. 'popularity',
  180. 'poster_path',
  181. 'status',
  182. 'vote_average',
  183. 'vote_count',
  184. );
  185. /**
  186. * Constructor
  187. *
  188. * Set all default collections
  189. */
  190. public function __construct()
  191. {
  192. $this->createdBy = new Images();
  193. $this->episodeRunTime = new GenericCollection();
  194. $this->genres = new Genres();
  195. $this->languages = new GenericCollection();
  196. $this->networks = new GenericCollection();
  197. $this->originCountry = new GenericCollection();
  198. $this->seasons = new GenericCollection();
  199. $this->credits = new CreditsCollection();
  200. $this->externalIds = new ExternalIds();
  201. $this->images = new Images();
  202. $this->translations = new GenericCollection();
  203. $this->videos = new Videos();
  204. }
  205. /**
  206. * @param string $backdropPath
  207. * @return $this
  208. */
  209. public function setBackdropPath($backdropPath)
  210. {
  211. $this->backdropPath = $backdropPath;
  212. return $this;
  213. }
  214. /**
  215. * @return string
  216. */
  217. public function getBackdropPath()
  218. {
  219. return $this->backdropPath;
  220. }
  221. /**
  222. * @param \Tmdb\Model\Common\Collection $createdBy
  223. * @return $this
  224. */
  225. public function setCreatedBy($createdBy)
  226. {
  227. $this->createdBy = $createdBy;
  228. return $this;
  229. }
  230. /**
  231. * @return \Tmdb\Model\Common\Collection
  232. */
  233. public function getCreatedBy()
  234. {
  235. return $this->createdBy;
  236. }
  237. /**
  238. * @param array $episodeRunTime
  239. * @return $this
  240. */
  241. public function setEpisodeRunTime($episodeRunTime)
  242. {
  243. $this->episodeRunTime = $episodeRunTime;
  244. return $this;
  245. }
  246. /**
  247. * @return array
  248. */
  249. public function getEpisodeRunTime()
  250. {
  251. return $this->episodeRunTime;
  252. }
  253. /**
  254. * @param \DateTime $firstAirDate
  255. * @return $this
  256. */
  257. public function setFirstAirDate($firstAirDate)
  258. {
  259. if (!$firstAirDate instanceof \DateTime) {
  260. $firstAirDate = new \DateTime($firstAirDate);
  261. }
  262. $this->firstAirDate = $firstAirDate;
  263. return $this;
  264. }
  265. /**
  266. * @return \DateTime
  267. */
  268. public function getFirstAirDate()
  269. {
  270. return $this->firstAirDate;
  271. }
  272. /**
  273. * @param \Tmdb\Model\Collection\Genres $genres
  274. * @return $this
  275. */
  276. public function setGenres($genres)
  277. {
  278. $this->genres = $genres;
  279. return $this;
  280. }
  281. /**
  282. * @return \Tmdb\Model\Collection\Genres
  283. */
  284. public function getGenres()
  285. {
  286. return $this->genres;
  287. }
  288. /**
  289. * @param string $homepage
  290. * @return $this
  291. */
  292. public function setHomepage($homepage)
  293. {
  294. $this->homepage = $homepage;
  295. return $this;
  296. }
  297. /**
  298. * @return string
  299. */
  300. public function getHomepage()
  301. {
  302. return $this->homepage;
  303. }
  304. /**
  305. * @param int $id
  306. * @return $this
  307. */
  308. public function setId($id)
  309. {
  310. $this->id = (int) $id;
  311. return $this;
  312. }
  313. /**
  314. * @return int
  315. */
  316. public function getId()
  317. {
  318. return $this->id;
  319. }
  320. /**
  321. * @param boolean $inProduction
  322. * @return $this
  323. */
  324. public function setInProduction($inProduction)
  325. {
  326. $this->inProduction = $inProduction;
  327. return $this;
  328. }
  329. /**
  330. * @return boolean
  331. */
  332. public function getInProduction()
  333. {
  334. return $this->inProduction;
  335. }
  336. /**
  337. * @param array $languages
  338. * @return $this
  339. */
  340. public function setLanguages($languages)
  341. {
  342. $this->languages = $languages;
  343. return $this;
  344. }
  345. /**
  346. * @return array
  347. */
  348. public function getLanguages()
  349. {
  350. return $this->languages;
  351. }
  352. /**
  353. * @param string $lastAirDate
  354. * @return $this
  355. */
  356. public function setLastAirDate($lastAirDate)
  357. {
  358. if (!$lastAirDate instanceof \DateTime) {
  359. $lastAirDate = new \DateTime($lastAirDate);
  360. }
  361. $this->lastAirDate = $lastAirDate;
  362. return $this;
  363. }
  364. /**
  365. * @return \DateTime
  366. */
  367. public function getLastAirDate()
  368. {
  369. return $this->lastAirDate;
  370. }
  371. /**
  372. * @param string $name
  373. * @return $this
  374. */
  375. public function setName($name)
  376. {
  377. $this->name = $name;
  378. return $this;
  379. }
  380. /**
  381. * @return string
  382. */
  383. public function getName()
  384. {
  385. return $this->name;
  386. }
  387. /**
  388. * @param GenericCollection $networks
  389. * @return $this
  390. */
  391. public function setNetworks($networks)
  392. {
  393. $this->networks = $networks;
  394. return $this;
  395. }
  396. /**
  397. * @return Network[]
  398. */
  399. public function getNetworks()
  400. {
  401. return $this->networks;
  402. }
  403. /**
  404. * @param int $numberOfEpisodes
  405. * @return $this
  406. */
  407. public function setNumberOfEpisodes($numberOfEpisodes)
  408. {
  409. $this->numberOfEpisodes = (int) $numberOfEpisodes;
  410. return $this;
  411. }
  412. /**
  413. * @return int
  414. */
  415. public function getNumberOfEpisodes()
  416. {
  417. return $this->numberOfEpisodes;
  418. }
  419. /**
  420. * @param int $numberOfSeasons
  421. * @return $this
  422. */
  423. public function setNumberOfSeasons($numberOfSeasons)
  424. {
  425. $this->numberOfSeasons = (int) $numberOfSeasons;
  426. return $this;
  427. }
  428. /**
  429. * @return int
  430. */
  431. public function getNumberOfSeasons()
  432. {
  433. return $this->numberOfSeasons;
  434. }
  435. /**
  436. * @param \Tmdb\Model\Common\Collection $originCountry
  437. * @return $this
  438. */
  439. public function setOriginCountry($originCountry)
  440. {
  441. $this->originCountry = $originCountry;
  442. return $this;
  443. }
  444. /**
  445. * @return \Tmdb\Model\Common\Collection
  446. */
  447. public function getOriginCountry()
  448. {
  449. return $this->originCountry;
  450. }
  451. /**
  452. * @param string $originalName
  453. * @return $this
  454. */
  455. public function setOriginalName($originalName)
  456. {
  457. $this->originalName = $originalName;
  458. return $this;
  459. }
  460. /**
  461. * @return string
  462. */
  463. public function getOriginalName()
  464. {
  465. return $this->originalName;
  466. }
  467. /**
  468. * @param string $overview
  469. * @return $this
  470. */
  471. public function setOverview($overview)
  472. {
  473. $this->overview = $overview;
  474. return $this;
  475. }
  476. /**
  477. * @return string
  478. */
  479. public function getOverview()
  480. {
  481. return $this->overview;
  482. }
  483. /**
  484. * @param float $popularity
  485. * @return $this
  486. */
  487. public function setPopularity($popularity)
  488. {
  489. $this->popularity = (float) $popularity;
  490. return $this;
  491. }
  492. /**
  493. * @return float
  494. */
  495. public function getPopularity()
  496. {
  497. return $this->popularity;
  498. }
  499. /**
  500. * @param string $posterPath
  501. * @return $this
  502. */
  503. public function setPosterPath($posterPath)
  504. {
  505. $this->posterPath = $posterPath;
  506. return $this;
  507. }
  508. /**
  509. * @return string
  510. */
  511. public function getPosterPath()
  512. {
  513. return $this->posterPath;
  514. }
  515. /**
  516. * @param GenericCollection $seasons
  517. * @return $this
  518. */
  519. public function setSeasons($seasons)
  520. {
  521. $this->seasons = $seasons;
  522. return $this;
  523. }
  524. /**
  525. * @return \Tmdb\Model\Common\Collection
  526. */
  527. public function getSeasons()
  528. {
  529. return $this->seasons;
  530. }
  531. /**
  532. * @param string $status
  533. * @return $this
  534. */
  535. public function setStatus($status)
  536. {
  537. $this->status = $status;
  538. return $this;
  539. }
  540. /**
  541. * @return string
  542. */
  543. public function getStatus()
  544. {
  545. return $this->status;
  546. }
  547. /**
  548. * @param float $voteAverage
  549. * @return $this
  550. */
  551. public function setVoteAverage($voteAverage)
  552. {
  553. $this->voteAverage = (float) $voteAverage;
  554. return $this;
  555. }
  556. /**
  557. * @return float
  558. */
  559. public function getVoteAverage()
  560. {
  561. return $this->voteAverage;
  562. }
  563. /**
  564. * @param int $voteCount
  565. * @return $this
  566. */
  567. public function setVoteCount($voteCount)
  568. {
  569. $this->voteCount = (int) $voteCount;
  570. return $this;
  571. }
  572. /**
  573. * @return int
  574. */
  575. public function getVoteCount()
  576. {
  577. return $this->voteCount;
  578. }
  579. /**
  580. * @param GenericCollection $translations
  581. * @return $this
  582. */
  583. public function setTranslations($translations)
  584. {
  585. $this->translations = $translations;
  586. return $this;
  587. }
  588. /**
  589. * @return \Tmdb\Model\Common\Collection
  590. */
  591. public function getTranslations()
  592. {
  593. return $this->translations;
  594. }
  595. /**
  596. * @param \Tmdb\Model\Collection\Images $images
  597. * @return $this
  598. */
  599. public function setImages($images)
  600. {
  601. $this->images = $images;
  602. return $this;
  603. }
  604. /**
  605. * @return \Tmdb\Model\Collection\Images
  606. */
  607. public function getImages()
  608. {
  609. return $this->images;
  610. }
  611. /**
  612. * @param \Tmdb\Model\Common\ExternalIds $externalIds
  613. * @return $this
  614. */
  615. public function setExternalIds($externalIds)
  616. {
  617. $this->externalIds = $externalIds;
  618. return $this;
  619. }
  620. /**
  621. * @return \Tmdb\Model\Common\ExternalIds
  622. */
  623. public function getExternalIds()
  624. {
  625. return $this->externalIds;
  626. }
  627. /**
  628. * @param \Tmdb\Model\Collection\CreditsCollection $credits
  629. * @return $this
  630. */
  631. public function setCredits($credits)
  632. {
  633. $this->credits = $credits;
  634. return $this;
  635. }
  636. /**
  637. * @return \Tmdb\Model\Collection\CreditsCollection
  638. */
  639. public function getCredits()
  640. {
  641. return $this->credits;
  642. }
  643. /**
  644. * @param \Tmdb\Model\Image\BackdropImage $backdrop
  645. * @return $this
  646. */
  647. public function setBackdropImage(BackdropImage $backdrop)
  648. {
  649. $this->backdrop = $backdrop;
  650. return $this;
  651. }
  652. /**
  653. * @return \Tmdb\Model\Image\BackdropImage
  654. */
  655. public function getBackdropImage()
  656. {
  657. return $this->backdrop;
  658. }
  659. /**
  660. * @param \Tmdb\Model\Image\PosterImage $poster
  661. * @return $this
  662. */
  663. public function setPosterImage(PosterImage $poster)
  664. {
  665. $this->poster = $poster;
  666. return $this;
  667. }
  668. /**
  669. * @return \Tmdb\Model\Image\PosterImage
  670. */
  671. public function getPosterImage()
  672. {
  673. return $this->poster;
  674. }
  675. /**
  676. * @param \Tmdb\Model\Collection\Videos $videos
  677. * @return $this
  678. */
  679. public function setVideos($videos)
  680. {
  681. $this->videos = $videos;
  682. return $this;
  683. }
  684. /**
  685. * @return \Tmdb\Model\Collection\Videos
  686. */
  687. public function getVideos()
  688. {
  689. return $this->videos;
  690. }
  691. }