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 */ 13namespace Tmdb\Model\Tv; 14 15use Tmdb\Model\AbstractModel; 16use Tmdb\Model\Collection\Changes; 17use Tmdb\Model\Collection\CreditsCollection; 18use Tmdb\Model\Collection\Images; 19use Tmdb\Model\Collection\ResultCollection; 20use Tmdb\Model\Collection\Videos; 21use Tmdb\Model\Common\ExternalIds; 22use Tmdb\Model\Image\StillImage; 23 24/** 25 * Class Episode 26 * @package Tmdb\Model\Tv 27 */ 28class Episode extends AbstractModel 29{ 30 /** 31 * @var \DateTime 32 */ 33 private $airDate; 34 35 /** 36 * @var integer 37 */ 38 private $episodeNumber; 39 40 /** 41 * @var string 42 */ 43 private $name; 44 45 /** 46 * @var string 47 */ 48 private $overview; 49 50 /** 51 * @var integer 52 */ 53 private $id; 54 55 /** 56 * @var string 57 */ 58 private $productionCode; 59 60 /** 61 * @var integer 62 */ 63 private $seasonNumber; 64 65 /** 66 * @var string 67 */ 68 private $stillPath; 69 70 /** 71 * @var float 72 */ 73 private $voteAverage; 74 75 /** 76 * @var int 77 */ 78 private $voteCount; 79 80 /** 81 * Credits 82 * 83 * @var CreditsCollection 84 */ 85 protected $credits; 86 87 /** 88 * External Ids 89 * 90 * @var ExternalIds 91 */ 92 protected $externalIds; 93 94 /** 95 * Images 96 * 97 * @var Images 98 */ 99 protected $images; 100 101 /** 102 * @var StillImage 103 */ 104 protected $still; 105 106 /** 107 * @var Videos 108 */ 109 protected $videos; 110 111 protected $changes; 112 113 /** 114 * Properties that are available in the API 115 * 116 * These properties are hydrated by the ObjectHydrator, all the other properties are handled by the factory. 117 * 118 * @var array 119 */ 120 public static $properties = [ 121 'air_date', 122 'episode_number', 123 'name', 124 'overview', 125 'id', 126 'production_code', 127 'season_number', 128 'still_path', 129 'vote_average', 130 'vote_count' 131 ]; 132 133 /** 134 * Constructor 135 */ 136 public function __construct() 137 { 138 $this->credits = new CreditsCollection(); 139 $this->externalIds = new ExternalIds(); 140 $this->images = new Images(); 141 $this->videos = new Videos(); 142 $this->changes = new Changes(); 143 } 144 145 /** 146 * @param \DateTime $airDate 147 * @return $this 148 */ 149 public function setAirDate($airDate) 150 { 151 if (!$airDate instanceof \DateTime) { 152 $airDate = new \DateTime($airDate); 153 } 154 155 $this->airDate = $airDate; 156 157 return $this; 158 } 159 160 /** 161 * @return \DateTime 162 */ 163 public function getAirDate() 164 { 165 return $this->airDate; 166 } 167 168 /** 169 * @param int $episodeNumber 170 * @return $this 171 */ 172 public function setEpisodeNumber($episodeNumber) 173 { 174 $this->episodeNumber = (int) $episodeNumber; 175 176 return $this; 177 } 178 179 /** 180 * @return int 181 */ 182 public function getEpisodeNumber() 183 { 184 return $this->episodeNumber; 185 } 186 187 /** 188 * @param int $id 189 * @return $this 190 */ 191 public function setId($id) 192 { 193 $this->id = (int) $id; 194 195 return $this; 196 } 197 198 /** 199 * @return int 200 */ 201 public function getId() 202 { 203 return $this->id; 204 } 205 206 /** 207 * @param string $name 208 * @return $this 209 */ 210 public function setName($name) 211 { 212 $this->name = $name; 213 214 return $this; 215 } 216 217 /** 218 * @return string 219 */ 220 public function getName() 221 { 222 return $this->name; 223 } 224 225 /** 226 * @param string $overview 227 * @return $this 228 */ 229 public function setOverview($overview) 230 { 231 $this->overview = $overview; 232 233 return $this; 234 } 235 236 /** 237 * @return string 238 */ 239 public function getOverview() 240 { 241 return $this->overview; 242 } 243 244 /** 245 * @param string $productionCode 246 * @return $this 247 */ 248 public function setProductionCode($productionCode) 249 { 250 $this->productionCode = $productionCode; 251 252 return $this; 253 } 254 255 /** 256 * @return string 257 */ 258 public function getProductionCode() 259 { 260 return $this->productionCode; 261 } 262 263 /** 264 * @param int $seasonNumber 265 * @return $this 266 */ 267 public function setSeasonNumber($seasonNumber) 268 { 269 $this->seasonNumber = (int) $seasonNumber; 270 271 return $this; 272 } 273 274 /** 275 * @return int 276 */ 277 public function getSeasonNumber() 278 { 279 return $this->seasonNumber; 280 } 281 282 /** 283 * @param string $stillPath 284 * @return $this 285 */ 286 public function setStillPath($stillPath) 287 { 288 $this->stillPath = $stillPath; 289 290 return $this; 291 } 292 293 /** 294 * @return string 295 */ 296 public function getStillPath() 297 { 298 return $this->stillPath; 299 } 300 301 /** 302 * @param float $voteAverage 303 * @return $this 304 */ 305 public function setVoteAverage($voteAverage) 306 { 307 $this->voteAverage = (float) $voteAverage; 308 309 return $this; 310 } 311 312 /** 313 * @return float 314 */ 315 public function getVoteAverage() 316 { 317 return $this->voteAverage; 318 } 319 320 /** 321 * @param int $voteCount 322 * @return $this 323 */ 324 public function setVoteCount($voteCount) 325 { 326 $this->voteCount = (int) $voteCount; 327 328 return $this; 329 } 330 331 /** 332 * @return int 333 */ 334 public function getVoteCount() 335 { 336 return $this->voteCount; 337 } 338 339 /** 340 * @param CreditsCollection $credits 341 * @return $this 342 */ 343 public function setCredits($credits) 344 { 345 $this->credits = $credits; 346 347 return $this; 348 } 349 350 /** 351 * @return CreditsCollection 352 */ 353 public function getCredits() 354 { 355 return $this->credits; 356 } 357 358 /** 359 * @param ExternalIds $externalIds 360 * @return $this 361 */ 362 public function setExternalIds($externalIds) 363 { 364 $this->externalIds = $externalIds; 365 366 return $this; 367 } 368 369 /** 370 * @return ExternalIds 371 */ 372 public function getExternalIds() 373 { 374 return $this->externalIds; 375 } 376 377 /** 378 * @param Images $images 379 * @return $this 380 */ 381 public function setImages($images) 382 { 383 $this->images = $images; 384 385 return $this; 386 } 387 388 /** 389 * @return Images 390 */ 391 public function getImages() 392 { 393 return $this->images; 394 } 395 396 /** 397 * @param StillImage $still 398 * @return $this 399 */ 400 public function setStillImage($still) 401 { 402 $this->still = $still; 403 404 return $this; 405 } 406 407 /** 408 * @return StillImage 409 */ 410 public function getStillImage() 411 { 412 return $this->still; 413 } 414 415 /** 416 * @param \Tmdb\Model\Collection\Videos|ResultCollection $videos 417 * @return $this 418 */ 419 public function setVideos($videos) 420 { 421 $this->videos = $videos; 422 423 return $this; 424 } 425 426 /** 427 * @return Videos 428 */ 429 public function getVideos() 430 { 431 return $this->videos; 432 } 433 434 /** 435 * @param \Tmdb\Model\Collection\Changes $changes 436 * @return $this 437 */ 438 public function setChanges($changes) 439 { 440 $this->changes = $changes; 441 442 return $this; 443 } 444 445 /** 446 * @return \Tmdb\Model\Collection\Changes 447 */ 448 public function getChanges() 449 { 450 return $this->changes; 451 } 452} 453