Skip to content

Commit

Permalink
Updating scrutinizer to take it easy on big model collections in the …
Browse files Browse the repository at this point in the history
…root
  • Loading branch information
wtfzdotnet committed Feb 8, 2014
1 parent c89dc45 commit b3705b2
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .scrutinizer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ before_commands:

filter:
paths: [lib/*]
excluded_paths: [bin/*, examples/*, vendor/*]
excluded_paths: [ bin/*, examples/*, vendor/*, lib/Tmdb/Model/*.php ]
23 changes: 23 additions & 0 deletions lib/Tmdb/Model/Collection/Images.php
Original file line number Diff line number Diff line change
Expand Up @@ -163,4 +163,27 @@ function($key, $value) use ($height) {
}
);
}

/**
* Return a single image that is rated highest
*
* @return ImageFilter|null
*/
public function filterBestVotedImage()
{
$currentImage = null;
$voteAverage = 0;

/**
* @var $image Image
*/
foreach($this->data as $image) {
if ($image->getVoteAverage() > $voteAverage) {
$voteAverage = $image->getVoteAverage();
$currentImage = $image;
}
}

return $currentImage;
}
}
12 changes: 0 additions & 12 deletions test/Tmdb/Tests/Factory/ImageFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -186,18 +186,6 @@ public function shouldFilterMaxWidth()
}
}

/**
* @test
*/
public function shouldFilterBestImage()
{
$this->setUp();

$image = $this->images->filterBestVotedImage();

$this->assertInstanceOf('Tmdb\Model\Image', $image);
}

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

0 comments on commit b3705b2

Please sign in to comment.