/modules/Tmdb/Model/Movie.php

https://gitlab.com/x33n/ampache · PHP · 981 lines · 428 code · 152 blank · 401 comment · 1 complexity · 06d684b34bc805e41af620488214fff9 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\ResultCollection;
  15. use Tmdb\Model\Collection\Videos;
  16. use Tmdb\Model\Common\GenericCollection;
  17. use Tmdb\Model\Collection\CreditsCollection;
  18. use Tmdb\Model\Collection\Genres;
  19. use Tmdb\Model\Collection\Images;
  20. use Tmdb\Model\Common\Country;
  21. use Tmdb\Model\Common\SpokenLanguage;
  22. use Tmdb\Model\Common\Translation;
  23. use Tmdb\Model\Movie\AlternativeTitle;
  24. use Tmdb\Model\Movie\Release;
  25. /**
  26. * Class Movie
  27. * @package Tmdb\Model
  28. */
  29. class Movie extends AbstractModel
  30. {
  31. /**
  32. * @var bool
  33. */
  34. private $adult = false;
  35. /**
  36. * @var string
  37. */
  38. private $backdropPath;
  39. /**
  40. * @var Image
  41. */
  42. private $backdrop;
  43. /**
  44. * @var Collection
  45. */
  46. private $belongsToCollection = null;
  47. /**
  48. * @var int
  49. */
  50. private $budget;
  51. /**
  52. * @var Genres
  53. */
  54. private $genres;
  55. /**
  56. * @var string
  57. */
  58. private $homepage;
  59. /**
  60. * @var int
  61. */
  62. private $id;
  63. /**
  64. * @var string
  65. */
  66. private $imdbId;
  67. /**
  68. * @var string
  69. */
  70. private $originalTitle;
  71. /**
  72. * @var string
  73. */
  74. private $overview;
  75. /**
  76. * @var float
  77. */
  78. private $popularity;
  79. /**
  80. * @var Image
  81. */
  82. private $poster;
  83. /**
  84. * @var string
  85. */
  86. private $posterPath;
  87. /**
  88. * @var Collection
  89. */
  90. private $productionCompanies;
  91. /**
  92. * @var Collection
  93. */
  94. private $productionCountries;
  95. /**
  96. * @var \DateTime
  97. */
  98. private $releaseDate;
  99. /**
  100. * @var int
  101. */
  102. private $revenue;
  103. /**
  104. * @var int
  105. */
  106. private $runtime;
  107. /**
  108. * @var Collection
  109. */
  110. private $spokenLanguages;
  111. /**
  112. * @var string
  113. */
  114. private $status;
  115. /**
  116. * @var string
  117. */
  118. private $tagline;
  119. /**
  120. * @var string
  121. */
  122. private $title;
  123. /**
  124. * @var float
  125. */
  126. private $voteAverage;
  127. /**
  128. * @var int
  129. */
  130. private $voteCount;
  131. /**
  132. * @var Collection
  133. */
  134. protected $alternativeTitles;
  135. /**
  136. * @var Collection
  137. */
  138. protected $changes;
  139. /**
  140. * Credits
  141. *
  142. * @var Credits
  143. */
  144. protected $credits;
  145. /**
  146. * Images
  147. *
  148. * @var Images
  149. */
  150. protected $images;
  151. /**
  152. * @var Collection
  153. */
  154. protected $keywords;
  155. /**
  156. * @var Collection
  157. */
  158. protected $lists;
  159. /**
  160. * @var Collection
  161. */
  162. protected $releases;
  163. /**
  164. * @var Collection
  165. */
  166. protected $similarMovies;
  167. /**
  168. * @var Collection
  169. */
  170. protected $trailers;
  171. /**
  172. * @var Collection
  173. */
  174. protected $translations;
  175. /**
  176. * @var ResultCollection
  177. */
  178. protected $reviews;
  179. /**
  180. * @var Videos
  181. */
  182. protected $videos;
  183. /**
  184. * Properties that are available in the API
  185. *
  186. * These properties are hydrated by the ObjectHydrator, all the other properties are handled by the factory.
  187. *
  188. * @var array
  189. */
  190. public static $properties = array(
  191. 'adult',
  192. 'backdrop_path',
  193. 'belongs_to_collection',
  194. 'budget',
  195. 'homepage',
  196. 'id',
  197. 'imdb_id',
  198. 'original_title',
  199. 'overview',
  200. 'popularity',
  201. 'poster_path',
  202. 'release_date',
  203. 'revenue',
  204. 'runtime',
  205. 'status',
  206. 'tagline',
  207. 'title',
  208. 'vote_average',
  209. 'vote_count',
  210. );
  211. /**
  212. * Constructor
  213. *
  214. * Set all default collections
  215. */
  216. public function __construct()
  217. {
  218. $this->genres = new Genres();
  219. $this->productionCompanies = new GenericCollection();
  220. $this->productionCountries = new GenericCollection();
  221. $this->spokenLanguages = new GenericCollection();
  222. $this->alternativeTitles = new GenericCollection();
  223. $this->changes = new GenericCollection();
  224. $this->credits = new CreditsCollection();
  225. $this->images = new Images();
  226. $this->keywords = new GenericCollection();
  227. $this->lists = new GenericCollection();
  228. $this->releases = new GenericCollection();
  229. $this->similarMovies = new GenericCollection();
  230. $this->trailers = new GenericCollection();
  231. $this->translations = new GenericCollection();
  232. $this->videos = new Videos();
  233. }
  234. /**
  235. * @param boolean $adult
  236. * @return $this
  237. */
  238. public function setAdult($adult)
  239. {
  240. $this->adult = (bool) $adult;
  241. return $this;
  242. }
  243. /**
  244. * @return boolean
  245. */
  246. public function getAdult()
  247. {
  248. return $this->adult;
  249. }
  250. /**
  251. * @param mixed $backdropPath
  252. * @return $this
  253. */
  254. public function setBackdropPath($backdropPath)
  255. {
  256. $this->backdropPath = $backdropPath;
  257. return $this;
  258. }
  259. /**
  260. * @return mixed
  261. */
  262. public function getBackdropPath()
  263. {
  264. return $this->backdropPath;
  265. }
  266. /**
  267. * @param null $belongsToCollection
  268. * @return $this
  269. */
  270. public function setBelongsToCollection($belongsToCollection)
  271. {
  272. $this->belongsToCollection = $belongsToCollection;
  273. return $this;
  274. }
  275. /**
  276. * @return Collection|null
  277. */
  278. public function getBelongsToCollection()
  279. {
  280. return $this->belongsToCollection;
  281. }
  282. /**
  283. * @param GenericCollection $changes
  284. * @return $this
  285. */
  286. public function setChanges(GenericCollection $changes)
  287. {
  288. $this->changes = $changes;
  289. return $this;
  290. }
  291. /**
  292. * @return mixed
  293. */
  294. public function getChanges()
  295. {
  296. return $this->changes;
  297. }
  298. /**
  299. * @param Genres $genres
  300. * @return $this
  301. */
  302. public function setGenres(Genres $genres)
  303. {
  304. $this->genres = $genres;
  305. return $this;
  306. }
  307. /**
  308. * @return Genre[]
  309. */
  310. public function getGenres()
  311. {
  312. return $this->genres;
  313. }
  314. /**
  315. * @param mixed $homepage
  316. * @return $this
  317. */
  318. public function setHomepage($homepage)
  319. {
  320. $this->homepage = $homepage;
  321. return $this;
  322. }
  323. /**
  324. * @return mixed
  325. */
  326. public function getHomepage()
  327. {
  328. return $this->homepage;
  329. }
  330. /**
  331. * @param mixed $id
  332. * @return $this
  333. */
  334. public function setId($id)
  335. {
  336. $this->id = (int) $id;
  337. return $this;
  338. }
  339. /**
  340. * @return integer
  341. */
  342. public function getId()
  343. {
  344. return $this->id;
  345. }
  346. /**
  347. * @param Images $images
  348. * @return $this
  349. */
  350. public function setImages(Images $images)
  351. {
  352. $this->images = $images;
  353. return $this;
  354. }
  355. /**
  356. * @return Images Image[]
  357. */
  358. public function getImages()
  359. {
  360. return $this->images;
  361. }
  362. /**
  363. * @param mixed $imdbId
  364. * @return $this
  365. */
  366. public function setImdbId($imdbId)
  367. {
  368. $this->imdbId = $imdbId;
  369. return $this;
  370. }
  371. /**
  372. * @return mixed
  373. */
  374. public function getImdbId()
  375. {
  376. return $this->imdbId;
  377. }
  378. /**
  379. * @param mixed $originalTitle
  380. * @return $this
  381. */
  382. public function setOriginalTitle($originalTitle)
  383. {
  384. $this->originalTitle = $originalTitle;
  385. return $this;
  386. }
  387. /**
  388. * @return mixed
  389. */
  390. public function getOriginalTitle()
  391. {
  392. return $this->originalTitle;
  393. }
  394. /**
  395. * @param mixed $overview
  396. * @return $this
  397. */
  398. public function setOverview($overview)
  399. {
  400. $this->overview = $overview;
  401. return $this;
  402. }
  403. /**
  404. * @return mixed
  405. */
  406. public function getOverview()
  407. {
  408. return $this->overview;
  409. }
  410. /**
  411. * @param mixed $popularity
  412. * @return $this
  413. */
  414. public function setPopularity($popularity)
  415. {
  416. $this->popularity = (float) $popularity;
  417. return $this;
  418. }
  419. /**
  420. * @return double
  421. */
  422. public function getPopularity()
  423. {
  424. return $this->popularity;
  425. }
  426. /**
  427. * @param mixed $posterPath
  428. * @return $this
  429. */
  430. public function setPosterPath($posterPath)
  431. {
  432. $this->posterPath = $posterPath;
  433. return $this;
  434. }
  435. /**
  436. * @return mixed
  437. */
  438. public function getPosterPath()
  439. {
  440. return $this->posterPath;
  441. }
  442. /**
  443. * @param GenericCollection $productionCompanies
  444. * @return $this
  445. */
  446. public function setProductionCompanies(GenericCollection $productionCompanies)
  447. {
  448. $this->productionCompanies = $productionCompanies;
  449. return $this;
  450. }
  451. /**
  452. * @return Company[]
  453. */
  454. public function getProductionCompanies()
  455. {
  456. return $this->productionCompanies;
  457. }
  458. /**
  459. * @param GenericCollection $productionCountries
  460. * @return $this
  461. */
  462. public function setProductionCountries(GenericCollection $productionCountries)
  463. {
  464. $this->productionCountries = $productionCountries;
  465. return $this;
  466. }
  467. /**
  468. * @return Country
  469. */
  470. public function getProductionCountries()
  471. {
  472. return $this->productionCountries;
  473. }
  474. /**
  475. * @param string $releaseDate
  476. * @return $this
  477. */
  478. public function setReleaseDate($releaseDate)
  479. {
  480. if (!$releaseDate instanceof \DateTime) {
  481. $releaseDate = new \DateTime($releaseDate);
  482. }
  483. $this->releaseDate = $releaseDate;
  484. return $this;
  485. }
  486. /**
  487. * @return \DateTime
  488. */
  489. public function getReleaseDate()
  490. {
  491. return $this->releaseDate;
  492. }
  493. /**
  494. * @param mixed $revenue
  495. * @return $this
  496. */
  497. public function setRevenue($revenue)
  498. {
  499. $this->revenue = (int) $revenue;
  500. return $this;
  501. }
  502. /**
  503. * @return integer
  504. */
  505. public function getRevenue()
  506. {
  507. return $this->revenue;
  508. }
  509. /**
  510. * @param mixed $runtime
  511. * @return $this
  512. */
  513. public function setRuntime($runtime)
  514. {
  515. $this->runtime = (int) $runtime;
  516. return $this;
  517. }
  518. /**
  519. * @return integer
  520. */
  521. public function getRuntime()
  522. {
  523. return $this->runtime;
  524. }
  525. /**
  526. * @param GenericCollection $spokenLanguages
  527. * @return $this
  528. */
  529. public function setSpokenLanguages(GenericCollection $spokenLanguages)
  530. {
  531. $this->spokenLanguages = $spokenLanguages;
  532. return $this;
  533. }
  534. /**
  535. * @return SpokenLanguage[]
  536. */
  537. public function getSpokenLanguages()
  538. {
  539. return $this->spokenLanguages;
  540. }
  541. /**
  542. * @param mixed $status
  543. * @return $this
  544. */
  545. public function setStatus($status)
  546. {
  547. $this->status = $status;
  548. return $this;
  549. }
  550. /**
  551. * @return mixed
  552. */
  553. public function getStatus()
  554. {
  555. return $this->status;
  556. }
  557. /**
  558. * @param mixed $tagline
  559. * @return $this
  560. */
  561. public function setTagline($tagline)
  562. {
  563. $this->tagline = $tagline;
  564. return $this;
  565. }
  566. /**
  567. * @return mixed
  568. */
  569. public function getTagline()
  570. {
  571. return $this->tagline;
  572. }
  573. /**
  574. * @param mixed $title
  575. * @return $this
  576. */
  577. public function setTitle($title)
  578. {
  579. $this->title = $title;
  580. return $this;
  581. }
  582. /**
  583. * @return mixed
  584. */
  585. public function getTitle()
  586. {
  587. return $this->title;
  588. }
  589. /**
  590. * @param mixed $voteAverage
  591. * @return $this
  592. */
  593. public function setVoteAverage($voteAverage)
  594. {
  595. $this->voteAverage = (float) $voteAverage;
  596. return $this;
  597. }
  598. /**
  599. * @return double
  600. */
  601. public function getVoteAverage()
  602. {
  603. return $this->voteAverage;
  604. }
  605. /**
  606. * @param mixed $voteCount
  607. * @return $this
  608. */
  609. public function setVoteCount($voteCount)
  610. {
  611. $this->voteCount = (int) $voteCount;
  612. return $this;
  613. }
  614. /**
  615. * @return integer
  616. */
  617. public function getVoteCount()
  618. {
  619. return $this->voteCount;
  620. }
  621. /**
  622. * @param GenericCollection $alternativeTitles
  623. * @return $this
  624. */
  625. public function setAlternativeTitles($alternativeTitles)
  626. {
  627. $this->alternativeTitles = $alternativeTitles;
  628. return $this;
  629. }
  630. /**
  631. * @return GenericCollection|AlternativeTitle[]
  632. */
  633. public function getAlternativeTitles()
  634. {
  635. return $this->alternativeTitles;
  636. }
  637. /**
  638. * @param int $budget
  639. * @return $this
  640. */
  641. public function setBudget($budget)
  642. {
  643. $this->budget = $budget;
  644. return $this;
  645. }
  646. /**
  647. * @return int
  648. */
  649. public function getBudget()
  650. {
  651. return $this->budget;
  652. }
  653. /**
  654. * @param CreditsCollection $credits
  655. * @return $this
  656. */
  657. public function setCredits(CreditsCollection $credits)
  658. {
  659. $this->credits = $credits;
  660. return $this;
  661. }
  662. /**
  663. * @return CreditsCollection
  664. */
  665. public function getCredits()
  666. {
  667. return $this->credits;
  668. }
  669. /**
  670. * @param GenericCollection $keywords
  671. * @return $this
  672. */
  673. public function setKeywords($keywords)
  674. {
  675. $this->keywords = $keywords;
  676. return $this;
  677. }
  678. /**
  679. * @return Keyword[]
  680. */
  681. public function getKeywords()
  682. {
  683. return $this->keywords;
  684. }
  685. /**
  686. * @param GenericCollection $lists
  687. * @return $this
  688. */
  689. public function setLists($lists)
  690. {
  691. $this->lists = $lists;
  692. return $this;
  693. }
  694. /**
  695. * @return GenericCollection
  696. */
  697. public function getLists()
  698. {
  699. return $this->lists;
  700. }
  701. /**
  702. * @param GenericCollection $releases
  703. * @return $this
  704. */
  705. public function setReleases(GenericCollection $releases)
  706. {
  707. $this->releases = $releases;
  708. return $this;
  709. }
  710. /**
  711. * @return Release[]
  712. */
  713. public function getReleases()
  714. {
  715. return $this->releases;
  716. }
  717. /**
  718. * @param GenericCollection $similarMovies
  719. * @return $this
  720. */
  721. public function setSimilarMovies($similarMovies)
  722. {
  723. $this->similarMovies = $similarMovies;
  724. return $this;
  725. }
  726. /**
  727. * @return Movie[]
  728. */
  729. public function getSimilarMovies()
  730. {
  731. return $this->similarMovies;
  732. }
  733. /**
  734. * @param GenericCollection $trailers
  735. * @return $this
  736. */
  737. public function setTrailers($trailers)
  738. {
  739. $this->trailers = $trailers;
  740. return $this;
  741. }
  742. /**
  743. * @return \Tmdb\Model\Common\Trailer\Youtube[]
  744. */
  745. public function getTrailers()
  746. {
  747. return $this->trailers;
  748. }
  749. /**
  750. * @param GenericCollection $translations
  751. * @return $this
  752. */
  753. public function setTranslations($translations)
  754. {
  755. $this->translations = $translations;
  756. return $this;
  757. }
  758. /**
  759. * @return Translation[]
  760. */
  761. public function getTranslations()
  762. {
  763. return $this->translations;
  764. }
  765. /**
  766. * @param \Tmdb\Model\Image $backdrop
  767. * @return $this
  768. */
  769. public function setBackdropImage($backdrop)
  770. {
  771. $this->backdrop = $backdrop;
  772. return $this;
  773. }
  774. /**
  775. * @return \Tmdb\Model\Image
  776. */
  777. public function getBackdropImage()
  778. {
  779. return $this->backdrop;
  780. }
  781. /**
  782. * @param \Tmdb\Model\Image $poster
  783. * @return $this
  784. */
  785. public function setPosterImage($poster)
  786. {
  787. $this->poster = $poster;
  788. return $this;
  789. }
  790. /**
  791. * @return \Tmdb\Model\Image
  792. */
  793. public function getPosterImage()
  794. {
  795. return $this->poster;
  796. }
  797. /**
  798. * @param \Tmdb\Model\Collection\ResultCollection $reviews
  799. * @return $this
  800. */
  801. public function setReviews($reviews)
  802. {
  803. $this->reviews = $reviews;
  804. return $this;
  805. }
  806. /**
  807. * @return \Tmdb\Model\Collection\ResultCollection
  808. */
  809. public function getReviews()
  810. {
  811. return $this->reviews;
  812. }
  813. /**
  814. * @param \Tmdb\Model\Collection\Videos $videos
  815. * @return $this
  816. */
  817. public function setVideos($videos)
  818. {
  819. $this->videos = $videos;
  820. return $this;
  821. }
  822. /**
  823. * @return \Tmdb\Model\Collection\Videos
  824. */
  825. public function getVideos()
  826. {
  827. return $this->videos;
  828. }
  829. }