modules/custom/lter_unit/lib/LterUnitStmmlHelper.php

Summary

Maintainability
A
3 hrs
Test Coverage

Function getUnitStmml has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

  public static function getUnitStmml($unit, $use_cache = FALSE) {
    $stmml = NULL;
    $dom = new DOMDocument();

    try {
Severity: Minor
Found in modules/custom/lter_unit/lib/LterUnitStmmlHelper.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

Method getUnitStmml has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  public static function getUnitStmml($unit, $use_cache = FALSE) {
    $stmml = NULL;
    $dom = new DOMDocument();

    try {
Severity: Minor
Found in modules/custom/lter_unit/lib/LterUnitStmmlHelper.php - About 1 hr to fix

    Additional blank lines found at end of doc comment
    Open

       */

    The closing brace for the class must have an empty line before it
    Open

    }

    Expected 1 blank line after function; 0 found
    Open

      }

    Missing class doc comment
    Open

    class LterUnitStmmlHelper {

    Inline comments must end in full-stops, exclamation marks, colons, question marks, or closing parentheses
    Open

            // Inspect all the child elements of stmml:unitList

    Parameter tags must be grouped together in a doc comment
    Open

       * @param bool $use_cache

    Missing parameter comment
    Open

       * @param bool $use_cache

    There are no issues that match your filters.

    Category
    Status