forked from php-tmdb/api
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
02693b1
commit ae365f5
Showing
16 changed files
with
985 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
<?php | ||
/** | ||
* This file is part of the Tmdb PHP API created by Michael Roterman. | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
* | ||
* @package Tmdb | ||
* @author Michael Roterman <[email protected]> | ||
* @copyright (c) 2013, Michael Roterman | ||
* @version 0.0.1 | ||
*/ | ||
namespace Tmdb\Model; | ||
|
||
use Tmdb\Client; | ||
use Tmdb\Model\Common\Collection; | ||
|
||
abstract 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($date) | ||
{ | ||
$this->from = $date->format('Y-m-d'); | ||
|
||
return $this; | ||
} | ||
|
||
/** | ||
* Set the to parameter | ||
* | ||
* @param \DateTime $date | ||
* @return $this | ||
*/ | ||
public function to($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; | ||
} | ||
|
||
public function execute() | ||
{ | ||
$collection = new Collection(); | ||
|
||
$response = $this->getClient()->api('changes')->getMovieChanges(); | ||
|
||
if (!empty($response)) { | ||
foreach($response['results'] as $change) { | ||
$collection->add($change); | ||
} | ||
} | ||
|
||
return $collection; | ||
} | ||
|
||
abstract public function getEntity(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
<?php | ||
/** | ||
* This file is part of the Tmdb PHP API created by Michael Roterman. | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
* | ||
* @package Tmdb | ||
* @author Michael Roterman <[email protected]> | ||
* @copyright (c) 2013, Michael Roterman | ||
* @version 0.0.1 | ||
*/ | ||
namespace Tmdb\Model; | ||
|
||
use Tmdb\Client; | ||
|
||
class Change extends AbstractModel { | ||
|
||
private $id; | ||
private $name; | ||
|
||
protected static $_properties = array( | ||
'id', | ||
'name', | ||
); | ||
|
||
/** | ||
* Convert an array to an hydrated object | ||
* | ||
* @param Client $client | ||
* @param array $data | ||
* @return $this | ||
*/ | ||
public static function fromArray(Client $client, array $data) | ||
{ | ||
$genre = new Genre($data['id']); | ||
//$genre->setClient($client); | ||
|
||
return $genre->hydrate($data); | ||
} | ||
|
||
/** | ||
* Load a person with the given identifier | ||
* | ||
* @param Client $client | ||
* @param $id | ||
* @param $options | ||
* @return $this | ||
*/ | ||
public static function load(Client $client, $id, array $options = array()) { | ||
$data = $client->api('genres')->getGenre($id, $options); | ||
|
||
return Genre::fromArray($client, $data); | ||
} | ||
|
||
/** | ||
* @param mixed $id | ||
* @return $this | ||
*/ | ||
public function setId($id) | ||
{ | ||
$this->id = (int) $id; | ||
return $this; | ||
} | ||
|
||
/** | ||
* @return mixed | ||
*/ | ||
public function getId() | ||
{ | ||
return $this->id; | ||
} | ||
|
||
/** | ||
* @param mixed $name | ||
* @return $this | ||
*/ | ||
public function setName($name) | ||
{ | ||
$this->name = $name; | ||
return $this; | ||
} | ||
|
||
/** | ||
* @return mixed | ||
*/ | ||
public function getName() | ||
{ | ||
return $this->name; | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
<?php | ||
/** | ||
* This file is part of the Tmdb PHP API created by Michael Roterman. | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
* | ||
* @package Tmdb | ||
* @author Michael Roterman <[email protected]> | ||
* @copyright (c) 2013, Michael Roterman | ||
* @version 0.0.1 | ||
*/ | ||
namespace Tmdb\Model\Common; | ||
|
||
class Country extends AbstractModel { | ||
|
||
private $iso31661; | ||
private $name; | ||
|
||
protected static $_properties = array( | ||
'iso_3166_1', | ||
'name', | ||
); | ||
|
||
/** | ||
* @param mixed $iso31661 | ||
* @return $this | ||
*/ | ||
public function setIso31661($iso31661) | ||
{ | ||
$this->iso31661 = $iso31661; | ||
return $this; | ||
} | ||
|
||
/** | ||
* @return mixed | ||
*/ | ||
public function getIso31661() | ||
{ | ||
return $this->iso31661; | ||
} | ||
|
||
/** | ||
* @param mixed $name | ||
* @return $this | ||
*/ | ||
public function setName($name) | ||
{ | ||
$this->name = $name; | ||
return $this; | ||
} | ||
|
||
/** | ||
* @return mixed | ||
*/ | ||
public function getName() | ||
{ | ||
return $this->name; | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.