1: <?php
2: namespace Duyplus\TMDBApi\Classes\Data;
3:
4: use Duyplus\TMDBApi\Classes\Data\Season;
5:
6: class TVShow extends ApiBaseObject
7: {
8: //------------------------------------------------------------------------------
9: // Get Variables
10: //------------------------------------------------------------------------------
11:
12: /**
13: * Get the TVShow's name
14: *
15: * @return string
16: */
17: public function getName()
18: {
19: return $this->crawl['name'];
20: }
21:
22: /**
23: * Get the TVShow's original name
24: *
25: * @return string
26: */
27: public function getOriginalName()
28: {
29: return $this->crawl['original_name'];
30: }
31:
32: /**
33: * Get the TVShow's number of seasons
34: *
35: * @return int
36: */
37: public function getNumSeasons()
38: {
39: return $this->crawl['number_of_seasons'];
40: }
41:
42: /**
43: * Get the TVShow's number of episodes
44: *
45: * @return int
46: */
47: public function getNumEpisodes()
48: {
49: return $this->crawl['number_of_episodes'];
50: }
51:
52: /**
53: * Get a TVShow's season
54: *
55: * @param int $numSeason The season number
56: * @return Season
57: */
58: public function getSeason($numSeason)
59: {
60: $data = null;
61:
62: foreach ($this->crawl['seasons'] as $season) {
63: if ($season['season_number'] == $numSeason) {
64: $data = $season;
65: break;
66: }
67: }
68: return new Season($data);
69: }
70:
71: /**
72: * Get the TvShow's seasons
73: *
74: * @return Season[]
75: */
76: public function getSeasons()
77: {
78: $seasons = array();
79:
80: foreach ($this->crawl['seasons'] as $data) {
81: $seasons[] = new Season($data, $this->getID());
82: }
83:
84: return $seasons;
85: }
86:
87: /**
88: * Get the TVShow's Backdrop
89: *
90: * @return string
91: */
92: public function getBackdrop()
93: {
94: return $this->crawl['backdrop_path'];
95: }
96:
97: /**
98: * Get the TVShow's Overview
99: *
100: * @return string
101: */
102: public function getOverview()
103: {
104: return $this->crawl['overview'];
105: }
106:
107: /**
108: * Get if the TVShow is in production
109: *
110: * @return boolean
111: */
112: public function getInProduction()
113: {
114: return $this->crawl['in_production'];
115: }
116:
117: //------------------------------------------------------------------------------
118: // Export
119: //------------------------------------------------------------------------------
120:
121: /**
122: * Get the JSON representation of the TVShow
123: *
124: * @return string
125: */
126: public function getJSON()
127: {
128: return json_encode($this->crawl, JSON_PRETTY_PRINT);
129: }
130:
131: /**
132: * @return string
133: */
134: public function getMediaType()
135: {
136: return self::MEDIA_TYPE_TV;
137: }
138: }