Currently code was not analyzed against the Cyclomatic Complexity and other code quality metrics. Within this ticket this analysis should be performed, and some stuff fixed.
With help of this tool: https://phpmd.org/
About Cyclomatic Complexity: https://www.ibm.com/docs/en/raa/6.1?topic=metrics-cyclomatic-complexity