The Daily WTF wrote a nice and short article about NPath Complexity https://thedailywtf.com/articles/npath-complexity
If you don't know, it is one of the rules that we support with PHPMD: https://phpmd.org/rules/codesize.html#npathcomplexity
NPath Complexity
We're not going to look at code today, and instead, we're going to talk about a code metric. Specifically, "NPath complexity". NPath complexity is a good metric to track, and many static analyzers will do it. Formally written, it's defined: "The NPath complexity of a method is the number of acyclic execution paths through that method." Or, more simply, not counting loop iterations, this is how many branches you have in a single method.