I would use an interface to force that both methods are added and then use 2 classes that implement that interface
Seprate Service Class for API & Web?
I'm working on an eCommerce project where I've a service class ShipperService.php. Inside that service class I've got 2 methods authenticate() & register(). Now shipper can only authenticate via API call the response of which will be in JSON but, when it comes to register() method the shipper can register via API call as well as admin can create an account for shipper the response of which can be JSON or a simple boolean response.
Now my question is should I use separate service classes for APIs and Web routes or should I write some logic and make one method that can be used by both API controllers and Web controllers?
Please or to participate in this conversation.