diff --git a/lib/Tmdb/Model/Image.php b/lib/Tmdb/Model/Image.php index 07298f22..b04ee294 100644 --- a/lib/Tmdb/Model/Image.php +++ b/lib/Tmdb/Model/Image.php @@ -20,6 +20,7 @@ class Image extends AbstractModel { const FORMAT_BACKDROP = 'backdrop'; const FORMAT_PROFILE = 'profile'; const FORMAT_LOGO = 'logo'; + const FORMAT_STILL = 'still'; private $filePath; private $width; @@ -42,7 +43,8 @@ class Image extends AbstractModel { 'posters' => self::FORMAT_POSTER, 'backdrops' => self::FORMAT_BACKDROP, 'profiles' => self::FORMAT_PROFILE, - 'logos' => self::FORMAT_LOGO + 'logos' => self::FORMAT_LOGO, + 'stills' => self::FORMAT_STILL ); /** diff --git a/lib/Tmdb/Model/Query/Changes.php b/lib/Tmdb/Model/Query/Changes.php new file mode 100644 index 00000000..3b622606 --- /dev/null +++ b/lib/Tmdb/Model/Query/Changes.php @@ -0,0 +1,93 @@ + + * @copyright (c) 2013, Michael Roterman + * @version 0.0.1 + */ +namespace Tmdb\Model; + +use Tmdb\Client; +use Tmdb\Model\Changes\Change; +use Tmdb\Model\Common\Collection; + +class Changes extends AbstractModel { + + private $from = null; + private $to = null; + private $page = null; + + public function __construct(Client $client) + { + $this->setClient($client); + } + + /** + * Set the from parameter + * + * @param \DateTime $date + * @return $this + */ + public function from(\DateTime $date) + { + $this->from = $date->format('Y-m-d'); + + return $this; + } + + /** + * Set the to parameter + * + * @param \DateTime $date + * @return $this + */ + public function to(\DateTime $date) + { + $this->to = $date->format('Y-m-d'); + + return $this; + } + + /** + * Set the page parameter + * + * @param int $page + * @return $this + */ + public function page($page = 1) { + $this->page = (int) $page; + + return $this; + } + + /** + * Execute the current state + * + * @return Collection + */ + public function execute() + { + $collection = new Collection(); + + $response = $this->getClient()->api('changes')->getMovieChanges(array( + 'from' => $this->from, + 'to' => $this->to, + 'page' => $this->page + )); + + if (!empty($response)) { + foreach($response['results'] as $change) { + $collection->add(null, Change::fromArray($this->getClient(), $change)); + } + } + + return $collection; + } + + //abstract public function getEntity(); +} \ No newline at end of file diff --git a/lib/Tmdb/Model/Query/Discover.php b/lib/Tmdb/Model/Query/Discover.php new file mode 100644 index 00000000..1a4db537 --- /dev/null +++ b/lib/Tmdb/Model/Query/Discover.php @@ -0,0 +1,93 @@ + + * @copyright (c) 2013, Michael Roterman + * @version 0.0.1 + */ +namespace Tmdb\Model\Query; + +use Tmdb\Client; +use Tmdb\Model\Changes\Change; +use Tmdb\Model\Common\Collection; + +class Discover extends AbstractModel { + + private $from = null; + private $to = null; + private $page = null; + + public function __construct(Client $client) + { + $this->setClient($client); + } + + /** + * Set the from parameter + * + * @param \DateTime $date + * @return $this + */ + public function from(\DateTime $date) + { + $this->from = $date->format('Y-m-d'); + + return $this; + } + + /** + * Set the to parameter + * + * @param \DateTime $date + * @return $this + */ + public function to(\DateTime $date) + { + $this->to = $date->format('Y-m-d'); + + return $this; + } + + /** + * Set the page parameter + * + * @param int $page + * @return $this + */ + public function page($page = 1) { + $this->page = (int) $page; + + return $this; + } + + /** + * Execute the current state + * + * @return Collection + */ + public function execute() + { + $collection = new Collection(); + + $response = $this->getClient()->api('changes')->getMovieChanges(array( + 'from' => $this->from, + 'to' => $this->to, + 'page' => $this->page + )); + + if (!empty($response)) { + foreach($response['results'] as $change) { + $collection->add(null, Change::fromArray($this->getClient(), $change)); + } + } + + return $collection; + } + + //abstract public function getEntity(); +} \ No newline at end of file