public static function firstOr(Iterator $iterator, $default) { $iterator->rewind(); return $iterator->valid() ? $iterator->current() : $default; }