In the UK it’s called the Consumer Rights Act 2015. Although two years is mentioned the statute of limitations is set at six years.What country is this? EU regulation only requires 2 years of limited seller's liability... I am not aware of any statutory manufacturer's warranty, let alone for 5 years...
My iMac was in pristine condition, unmodified, so getting it done was easy through a reseller.
I imagine that has it have been battered and bruised Apple may have had grounds to refuse.