Problem/Motivation
Several methods across the module had a cyclomatic complexity of 15 or higher, making them difficult to read, test in isolation, and maintain. Affected classes include Element/Name.php, NameFormatter, NameWidget, AutocompleteService, ElementValidatorService, GeneratorService, NameFormatParserService, AdditionalComponentService, and NameFormSettingsHelperTrait.
Steps to reproduce
Run a cyclomatic complexity analyser (e.g. PHPMetrics or a PHPStan complexity rule) against the 8.x-1.x branch. The methods listed above all report complexity of 15 or higher.
Proposed resolution
Each oversized method was decomposed into focused private or protected helpers using the "extract method" pattern. The original method in each case now reads as a short, high-level sequence of named steps. New and expanded Unit and Kernel test classes were added alongside every refactored class to cover the extracted paths directly.
Remaining tasks
User interface changes
None. Rendered output of the formatter, widget, and element is identical to 8.x-1.x.
API changes
Data model changes
Issue fork name-3590747
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
bluegeek9 commentedComment #3
bluegeek9 commentedComment #6
bluegeek9 commented