God class (ARCH7189)
Dieser Inhalt ist noch nicht in deiner Sprache verfügbar.
Key php.quality.god-class · Severity warning · Category quality
Classes with many methods and fields usually take on several unrelated responsibilities, have low cohesion, and are hard to maintain. Split the responsibilities into separate classes.
Incorrect
Section titled “Incorrect”<?phpclass UserManager{ public function register() { /* ... */ } public function login() { /* ... */ } public function sendEmail() { /* ... */ } public function renderProfile() { /* ... */ } public function chargeCard() { /* ... */ } public function generateReport() { /* ... */ } // ... dozens of unrelated methods ...}Correct
Section titled “Correct”<?phpclass AuthService { public function register() {} public function login() {} }class Mailer { public function send() {} }class BillingService { public function charge() {} }Separate unrelated responsibilities into single-purpose classes.