PHP-Torrent-Scraper icon indicating copy to clipboard operation
PHP-Torrent-Scraper copied to clipboard

little optimization

Open bkfox opened this issue 12 years ago • 1 comments

In the udp scapper, you should invert

foreach($infohash as $hash){
if(!preg_match('#^[a-f0-9]{40}$#i',$hash)){ throw new ScraperException('Invalid infohash: ' . $hash . '.'); }
}
if(count($infohash) > 74){ throw new ScraperException('Too many infohashes provided.'); }

by:

if(count($infohash) > 74){ throw new ScraperException('Too many infohashes provided.'); }
foreach($infohash as $hash){
if(!preg_match('#^[a-f0-9]{40}$#i',$hash)){ throw new ScraperException('Invalid infohash: ' . $hash . '.'); }
}

it should be better for perfs

bkfox avatar Jul 11 '12 01:07 bkfox

It would be nice if you can send me this change as pull request

johannes85 avatar Jul 20 '12 09:07 johannes85