CRITICAL
Rule Definition
A class with too many dependencies has a negative impact on several quality aspects of a class, including stability, maintainability and understandability.
Remediation
Review the architecture of the application.
Violation Code Sample
<?php
class DependencySingleFunction
{
public function getDepend()
{
$this->depend1 = new Test1();
$this->depend2 = new Test2();
...
$this->depend14 = new Test14();
}
}
class DependencyMultipleFunctions
{
public function getDepend1()
{
$this->depend1 = new Test1();
}
public function getDepend2()
{
$this->depend2 = new Test2();
}
...
public function getDepend14()
{
$this->depend14 = new Test14();
}
?>
Reference
PHPMD - https://phpmd.org/rules/design.html#CouplingBetweenObjects
Related Technologies
Technical Criterion
Complexity - OO Inheritance and Polymorphism
About CAST Appmarq
CAST Appmarq is by far the biggest repository of data about real IT systems. It's built on thousands of analyzed applications, made of 35 different technologies, by over 300 business organizations across major verticals. It provides IT Leaders with factual key analytics to let them know if their applications are on track.