sroehrl/neoan3-template

View on GitHub

Showing 7 of 7 total issues

Function stepThrough has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    function stepThrough(DOMNodeList $nodes): void
    {
        foreach($nodes as $child){
            if($child instanceof DOMElement){
                // attributes?
Severity: Minor
Found in Interpreter.php - About 1 hr to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function __invoke has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    function __invoke(\DOMAttr &$attr, $contextData = []):void
    {
        $this->hit = false;
        $contextData = Constants::flattenArray($contextData);
        $toString = $attr->nodeValue;
Severity: Minor
Found in Attributes/NIf.php - About 35 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function flattenArray has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public static function flattenArray(iterable $data, string $parentKey = null): array
    {
        $answer = [];
        foreach ($data as $key => $value) {
            if ($parentKey) {
Severity: Minor
Found in Constants.php - About 25 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function handleSubstitutions has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function handleSubstitutions(string &$lookFor): array
    {
        $sanitized = preg_match_all('/\[%([^%\]]+)%\]\(%(.+?)(?=%\))%\)/', $lookFor, $preRendered, PREG_SET_ORDER);
        $substitutes = [];
        if($sanitized){
Severity: Minor
Found in Interpreter.php - About 25 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function executeFunction has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function executeFunction(callable $callable, $matches, $element): void
    {
        foreach($matches as $match){
            if(!empty($match[1]) && array_key_exists($match[1],$this->flatData)){
                $element->nodeValue = str_replace($match[0], $callable($this->flatData[$match[1]]), $element->nodeValue);
Severity: Minor
Found in Interpreter.php - About 25 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function replaceVariables has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function replaceVariables(array $matches, string $content): string
    {
        foreach ($matches as $pair){
            $lookFor = trim($pair[2]);
            $substitutes = $this->handleSubstitutions($lookFor);
Severity: Minor
Found in Interpreter.php - About 25 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function __invoke has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    function __invoke(\DOMAttr &$attr, $contextData = []): void
    {
        $this->contextData = $contextData;
        $this->flatData = Constants::flattenArray($contextData);

Severity: Minor
Found in Attributes/NFor.php - About 25 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Severity
Category
Status
Source
Language