The HTTP Request object has been passed to service classes. This hints to the code being highly coupled with Request Object that too is from the framework. This makes testing difficult as one has to mock this heavy request object. Just the data required should be passed to the domain layer, not HTTP-related objects. If objects are to be sent, DTOs could be an option.
|
class UserService |
|
{ |
|
public static function saveUserData($request) |
|
{ |
|
$validated = $request->validated(); |
The HTTP Request object has been passed to service classes. This hints to the code being highly coupled with Request Object that too is from the framework. This makes testing difficult as one has to mock this heavy request object. Just the data required should be passed to the domain layer, not HTTP-related objects. If objects are to be sent, DTOs could be an option.
TickerPRO-ProshoreTimeTrackingSystem-Backend/app/Services/UserService.php
Lines 19 to 23 in 542dd07