swap() doesn't reflect $quantity when provided

As best as I can tell $quantity is never assigned, only checked on Line 136.