Implement the REST detector as CakeRequest method

The anonymous function that was previously used caused failed tests
on PHP 5.2. This method uses a class method as callback instead.