CRITICAL
Rule Definition
Classes that have too many fields could be redesigned to have fewer fields, possibly through some nested object grouping of some of the information. For example, a class with city/state/zip fields could instead have one Address field.
Remediation
Modify the source code of the class to reduce the number of fields.
Violation Code Sample
class CastExample
{
protected $one;
private $two;
private $three;
[... many more fields ...]
protected $fourteen;
private $fifteen;
private $sixteen;
}
Reference
PHPMD - http://phpmd.org/rules/codesize.html#toomanymethods
Related Technologies
Technical Criterion
Programming Practices - 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.