One of the most flamboyant and controversial cricketers of his generation, former Pakistan captain Shahid Afridi has finally called time on his international career.