I have a PHP MVC application and a file table. I need to implement the functionality: mark all as read. The best solution for the code I found so far was to put the actual implementation in a Model/Service/FileService.php
The problem is the class FileService will get bloated really fast with different functionality.
What would be a good solution to avoid bloated Services. Should I created different Services for each action?
1
Start by using your FileService class. Once your service gets to bloated, extract classes from FileService and call these from FileService methods.
So, if you now have FileService->writeFile()
with the concrete implementation, your future implementation may contain:
function writeFile() {
new FileWriteService()->doStuff();
}
So, you can still put all file functions in one class while refactoring and grouping the concrete implementations.