Search for physics beyond the standard model in opposite-sign dilepton events in pp collisions at $\sqrt {s} = 7\,{\text{TeV}}$