Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
wtfzdotnet committed Mar 24, 2014
2 parents aeb9d80 + f4f9986 commit c56e06c
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions lib/Tmdb/Factory/PeopleFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@

use Tmdb\Common\ObjectHydrator;
use Tmdb\Factory\Common\ChangeFactory;
use Tmdb\Model\Collection\People\Cast;
use Tmdb\Model\Collection\People\Crew;
use Tmdb\Model\Collection\People;
use Tmdb\Model\Common\ExternalIds;
use Tmdb\Model\Person\CastMember;
Expand Down Expand Up @@ -49,7 +47,7 @@ public function __construct()
*
* @return Person|CrewMember|CastMember
*/
public function create(array $data = array(), Person\AbstractMember $person = null)
public function create(array $data = array(), $person = null)
{
if (!is_object($person)) {
if (array_key_exists('character', $data)) {
Expand Down Expand Up @@ -99,7 +97,7 @@ public function create(array $data = array(), Person\AbstractMember $person = nu
* @param array $data
* @param Person $person
*/
protected function applyCredits(array $data = array(), Person $person)
protected function applyCredits(array $data, Person $person)
{
$hydrator = new ObjectHydrator();
$types = array('movie_credits', 'tv_credits', 'combined_credits');
Expand Down Expand Up @@ -145,7 +143,7 @@ protected function getPosterImageForCredit($posterPath)
/**
* {@inheritdoc}
*/
public function createCollection(array $data = array(), Person\AbstractMember $person = null, $collection = null)
public function createCollection(array $data = array(), $person = null, $collection = null)
{
if (!$collection) {
$collection = new People();
Expand All @@ -155,7 +153,11 @@ public function createCollection(array $data = array(), Person\AbstractMember $p
$data = $data['results'];
}

$class = get_class($person);
if (is_object($person)) {
$class = get_class($person);
} else {
$class = '\Tmdb\Model\Person';
}

foreach ($data as $item) {
$collection->add(null, $this->create($item, new $class()));
Expand Down

0 comments on commit c56e06c

Please sign in to comment.