QuestionQ30

VerifiedEnforce coding standards

An Adobe Commerce Architect executes PHP Mess Detector from the command-line interface using the coding standard supplied with Adobe Commerce. The following output is displayed:

Question Image

The Architect reviews the class and observes that its constructor has 15 parameters. Five of those parameters are scalars that configure the behavior of MyService. The class also has three constants that reference another class.

How should the Architect correct the code to comply with the coding-standard rule?

Explanation

A dedicated configuration class groups the five scalar settings into one constructor dependency, reducing the service’s coupling while preserving explicit configuration semantics. This addresses the excessive Coupling Between Objects reported by PHP Mess Detector.

Community Discussion

No comments yet. Be the first to start the discussion!