-
-
Notifications
You must be signed in to change notification settings - Fork 112
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding guest stars to tv episodes, fixes #126
- Loading branch information
1 parent
19bfa63
commit 3ecf3d0
Showing
5 changed files
with
171 additions
and
2 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,44 @@ | ||
<?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\People; | ||
|
||
use Tmdb\Factory\PeopleFactory; | ||
use Tmdb\Model\Collection\People\GuestStars; | ||
|
||
/** | ||
* Class GuestStarFactory | ||
* @package Tmdb\Factory\People | ||
*/ | ||
class GuestStarFactory extends PeopleFactory | ||
{ | ||
/** | ||
* {@inheritdoc} | ||
* @param \Tmdb\Model\Person\CastMember $person | ||
*/ | ||
public function createCollection(array $data = [], $person = null) | ||
{ | ||
$collection = new GuestStars(); | ||
|
||
if (is_object($person)) { | ||
$class = get_class($person); | ||
} else { | ||
$class = '\Tmdb\Model\Person\GuestStar'; | ||
} | ||
|
||
foreach ($data as $item) { | ||
$collection->add(null, $this->create($item, new $class())); | ||
} | ||
|
||
return $collection; | ||
} | ||
} |
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,44 @@ | ||
<?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\Collection\People; | ||
|
||
use Tmdb\Model\Collection\People; | ||
use Tmdb\Model\Person; | ||
|
||
/** | ||
* Class GuestStars | ||
* @package Tmdb\Model\Collection\People | ||
*/ | ||
class GuestStars extends People | ||
{ | ||
/** | ||
* Returns all people | ||
* | ||
* @return Person[] | ||
*/ | ||
public function getGuestStars() | ||
{ | ||
return parent::getPeople(); | ||
} | ||
|
||
/** | ||
* Retrieve a cast member from the collection | ||
* | ||
* @param $id | ||
* @return Person | ||
*/ | ||
public function getGuestStar($id) | ||
{ | ||
return parent::getPerson($id); | ||
} | ||
} |
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,21 @@ | ||
<?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\Person; | ||
|
||
/** | ||
* Class GuestStar | ||
* @package Tmdb\Model\Person | ||
*/ | ||
class GuestStar extends CastMember | ||
{ | ||
} |