Skip to content

Commit

Permalink
Fixing some bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
wtfzdotnet committed Feb 4, 2014
1 parent 589262a commit d24e6d1
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 13 deletions.
18 changes: 9 additions & 9 deletions lib/Tmdb/Factory/PeopleFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,17 +66,17 @@ public function create(array $data = array(), Person\AbstractMember $person = nu
}
}

/** Images */
if (array_key_exists('images', $data)) {
$person->setImages($this->getImageFactory()->createCollectionFromPeople($data['images']));
}
if ($person instanceof Person) {
/** Images */
if (array_key_exists('images', $data)) {
$person->setImages($this->getImageFactory()->createCollectionFromPeople($data['images']));
}

if (array_key_exists('profile_path', $data)) {
$person->setProfile($this->getImageFactory()->createFromPath($data['profile_path'], 'profile_path'));
}
if (array_key_exists('profile_path', $data)) {
$person->setProfile($this->getImageFactory()->createFromPath($data['profile_path'], 'profile_path'));
}

/** Credits */
if ($person instanceof Person) {
/** Credits */
$this->applyCredits($data, $person);
}

Expand Down
2 changes: 1 addition & 1 deletion lib/Tmdb/Model/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class Collection extends AbstractModel {
public function __construct()
{
$this->parts = new GenericCollection();
$this->iamges = new Images();
$this->images = new Images();
}

/**
Expand Down
6 changes: 4 additions & 2 deletions lib/Tmdb/Model/Person/AbstractMember.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ abstract class AbstractMember extends AbstractModel {
private $id;
private $name;
private $profilePath;
private $order;

/**
* @var Image
Expand All @@ -29,6 +30,7 @@ abstract class AbstractMember extends AbstractModel {
public static $_properties = array(
'id',
'name',
'order',
'profile_path'
);

Expand Down Expand Up @@ -87,7 +89,7 @@ public function getProfilePath()
}

/**
* @param mixed $order
* @param integer $order
* @return $this
*/
public function setOrder($order)
Expand All @@ -97,7 +99,7 @@ public function setOrder($order)
}

/**
* @return mixed
* @return integer
*/
public function getOrder()
{
Expand Down
2 changes: 1 addition & 1 deletion lib/Tmdb/Model/Tv/Season.php
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ public function getSeasonNumber()
}

/**
* @param GenericCollection $credits
* @param Credits $credits
* @return $this
*/
public function setCredits($credits)
Expand Down
11 changes: 11 additions & 0 deletions test/Tmdb/Tests/Factory/PeopleFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,17 @@ public function shouldBeFunctional()
$this->assertInstanceOf('Tmdb\Model\Collection\Credits\TvCredits', $this->person->getTvCredits());
}

/**
* @test
*/
public function shouldSetDeathDay()
{
$person = new Person();
$person->setDeathday('2013-12-12');

$this->assertInstanceOf('\DateTime', $person->getDeathday());
}

protected function getFactoryClass()
{
return 'Tmdb\Factory\PeopleFactory';
Expand Down

0 comments on commit d24e6d1

Please sign in to comment.