/**
* Construct a limited stream.
*
* @param type $source
* @param type $limit The number of items to show, at most.
* @throws InvalidArgumentException
*/
public function __construct($source, $limit)
{
parent::__construct($source);
if ($limit < 0) {
throw new InvalidArgumentException("Limit should be at least 0.");
}
$this->limit = $limit;
}