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
d958f28
commit 53f109c
Showing
20 changed files
with
1,159 additions
and
15 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?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 | ||
*/ | ||
require_once('../../../vendor/autoload.php'); | ||
require_once('../../../apikey.php'); | ||
|
||
$token = new \Tmdb\ApiToken(TMDB_API_KEY); | ||
$client = new \Tmdb\Client($token); | ||
|
||
$sessionToken = new \Tmdb\SessionToken(TMDB_SESSION_TOKEN); | ||
$client->setSessionToken($sessionToken); | ||
|
||
$accountRepository = new \Tmdb\Repository\AccountRepository($client); | ||
$account = $accountRepository->getAccount(); | ||
|
||
var_dump($account); | ||
|
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,29 @@ | ||
<?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 | ||
*/ | ||
require_once('../../../vendor/autoload.php'); | ||
require_once('../../../apikey.php'); | ||
|
||
$token = new \Tmdb\ApiToken(TMDB_API_KEY); | ||
$client = new \Tmdb\Client($token); | ||
|
||
$sessionToken = new \Tmdb\SessionToken(TMDB_SESSION_TOKEN); | ||
$client->setSessionToken($sessionToken); | ||
|
||
/** | ||
* @var \Tmdb\Repository\AccountRepository $accountRepository | ||
*/ | ||
$accountRepository = new \Tmdb\Repository\AccountRepository($client); | ||
$lists = $accountRepository->favorite(TMDB_ACCOUNT_ID, 150); | ||
|
||
var_dump($lists); | ||
|
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,29 @@ | ||
<?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 | ||
*/ | ||
require_once('../../../vendor/autoload.php'); | ||
require_once('../../../apikey.php'); | ||
|
||
$token = new \Tmdb\ApiToken(TMDB_API_KEY); | ||
$client = new \Tmdb\Client($token); | ||
|
||
$sessionToken = new \Tmdb\SessionToken(TMDB_SESSION_TOKEN); | ||
$client->setSessionToken($sessionToken); | ||
|
||
/** | ||
* @var \Tmdb\Repository\AccountRepository $accountRepository | ||
*/ | ||
$accountRepository = new \Tmdb\Repository\AccountRepository($client); | ||
$lists = $accountRepository->getFavoriteMovies(TMDB_ACCOUNT_ID); | ||
|
||
var_dump($lists); | ||
|
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,29 @@ | ||
<?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 | ||
*/ | ||
require_once('../../../vendor/autoload.php'); | ||
require_once('../../../apikey.php'); | ||
|
||
$token = new \Tmdb\ApiToken(TMDB_API_KEY); | ||
$client = new \Tmdb\Client($token); | ||
|
||
$sessionToken = new \Tmdb\SessionToken(TMDB_SESSION_TOKEN); | ||
$client->setSessionToken($sessionToken); | ||
|
||
/** | ||
* @var \Tmdb\Repository\AccountRepository $accountRepository | ||
*/ | ||
$accountRepository = new \Tmdb\Repository\AccountRepository($client); | ||
$lists = $accountRepository->getLists(TMDB_ACCOUNT_ID); | ||
|
||
var_dump($lists); | ||
|
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,29 @@ | ||
<?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 | ||
*/ | ||
require_once('../../../vendor/autoload.php'); | ||
require_once('../../../apikey.php'); | ||
|
||
$token = new \Tmdb\ApiToken(TMDB_API_KEY); | ||
$client = new \Tmdb\Client($token); | ||
|
||
$sessionToken = new \Tmdb\SessionToken(TMDB_SESSION_TOKEN); | ||
$client->setSessionToken($sessionToken); | ||
|
||
/** | ||
* @var \Tmdb\Repository\AccountRepository $accountRepository | ||
*/ | ||
$accountRepository = new \Tmdb\Repository\AccountRepository($client); | ||
$lists = $accountRepository->getMovieWatchlist(TMDB_ACCOUNT_ID); | ||
|
||
var_dump($lists); | ||
|
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,29 @@ | ||
<?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 | ||
*/ | ||
require_once('../../../vendor/autoload.php'); | ||
require_once('../../../apikey.php'); | ||
|
||
$token = new \Tmdb\ApiToken(TMDB_API_KEY); | ||
$client = new \Tmdb\Client($token); | ||
|
||
$sessionToken = new \Tmdb\SessionToken(TMDB_SESSION_TOKEN); | ||
$client->setSessionToken($sessionToken); | ||
|
||
/** | ||
* @var \Tmdb\Repository\AccountRepository $accountRepository | ||
*/ | ||
$accountRepository = new \Tmdb\Repository\AccountRepository($client); | ||
$lists = $accountRepository->getRatedMovies(TMDB_ACCOUNT_ID); | ||
|
||
var_dump($lists); | ||
|
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,29 @@ | ||
<?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 | ||
*/ | ||
require_once('../../../vendor/autoload.php'); | ||
require_once('../../../apikey.php'); | ||
|
||
$token = new \Tmdb\ApiToken(TMDB_API_KEY); | ||
$client = new \Tmdb\Client($token); | ||
|
||
$sessionToken = new \Tmdb\SessionToken(TMDB_SESSION_TOKEN); | ||
$client->setSessionToken($sessionToken); | ||
|
||
/** | ||
* @var \Tmdb\Repository\AccountRepository $accountRepository | ||
*/ | ||
$accountRepository = new \Tmdb\Repository\AccountRepository($client); | ||
$lists = $accountRepository->watchlist(TMDB_ACCOUNT_ID, 49047); | ||
|
||
var_dump($lists); | ||
|
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
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,25 @@ | ||
<?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 | ||
*/ | ||
require_once('../../../vendor/autoload.php'); | ||
require_once('../../../apikey.php'); | ||
|
||
$token = new \Tmdb\ApiToken(TMDB_API_KEY); | ||
$client = new \Tmdb\Client($token); | ||
|
||
$sessionToken = new \Tmdb\SessionToken(TMDB_SESSION_TOKEN); | ||
$client->setSessionToken($sessionToken); | ||
|
||
$repository = new \Tmdb\Repository\MovieRepository($client); | ||
$accountStates = $repository->getAccountStates(97020); | ||
|
||
var_dump($accountStates); |
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,25 @@ | ||
<?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 | ||
*/ | ||
require_once('../../../vendor/autoload.php'); | ||
require_once('../../../apikey.php'); | ||
|
||
$token = new \Tmdb\ApiToken(TMDB_API_KEY); | ||
$client = new \Tmdb\Client($token); | ||
|
||
$sessionToken = new \Tmdb\SessionToken(TMDB_SESSION_TOKEN); | ||
$client->setSessionToken($sessionToken); | ||
|
||
$repository = new \Tmdb\Repository\MovieRepository($client); | ||
$rate = $repository->rate(49047, 6.5); | ||
|
||
var_dump($rate); |
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,97 @@ | ||
<?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\Factory; | ||
|
||
use Tmdb\Exception\NotImplementedException; | ||
use Tmdb\Model\Account; | ||
use Tmdb\Model\Lists\Result; | ||
|
||
class AccountFactory extends AbstractFactory | ||
{ | ||
/** | ||
* @var MovieFactory | ||
*/ | ||
private $movieFactory; | ||
|
||
public function __construct() | ||
{ | ||
$this->movieFactory = new MovieFactory(); | ||
} | ||
|
||
/** | ||
* @param array $data | ||
* | ||
* @return Account | ||
*/ | ||
public function create(array $data = array()) | ||
{ | ||
return $this->hydrate(new Account(), $data); | ||
} | ||
|
||
/** | ||
* @param array $data | ||
* | ||
* @return Result | ||
*/ | ||
public function createStatusResult(array $data = array()) | ||
{ | ||
return $this->hydrate(new Result(), $data); | ||
} | ||
|
||
/** | ||
* Create movie | ||
* | ||
* @param array $data | ||
* @return \Tmdb\Model\Movie | ||
*/ | ||
public function createMovie(array $data = array()) { | ||
return $this->getMovieFactory()->create($data); | ||
} | ||
|
||
/** | ||
* Create list item | ||
* | ||
* @param array $data | ||
* @return \Tmdb\Model\AbstractModel | ||
*/ | ||
public function createListItem(array $data = array()) | ||
{ | ||
return $this->hydrate(new Account\ListItem(), $data); | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function createCollection(array $data = array()) | ||
{ | ||
throw new NotImplementedException('Not implemented'); | ||
} | ||
|
||
/** | ||
* @param \Tmdb\Factory\MovieFactory $movieFactory | ||
* @return $this | ||
*/ | ||
public function setMovieFactory($movieFactory) | ||
{ | ||
$this->movieFactory = $movieFactory; | ||
return $this; | ||
} | ||
|
||
/** | ||
* @return \Tmdb\Factory\MovieFactory | ||
*/ | ||
public function getMovieFactory() | ||
{ | ||
return $this->movieFactory; | ||
} | ||
} |
Oops, something went wrong.