web/lib/admin/API.php

Summary

Maintainability
D
2 days
Test Coverage

Function scrub has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
Open

    public function scrub($inputJson, $fedObject) {
        $optionInstance = \core\Options::instance();
        $parameters = [];
        $allPossibleAttribs = array_merge(API::ACTIONS[$inputJson['ACTION']]['REQ'], API::ACTIONS[$inputJson['ACTION']]['OPT']);
        // some actions don't need parameters. Don't get excited when there aren't any.
Severity: Minor
Found in web/lib/admin/API.php - About 5 hrs 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

File API.php has 388 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

/**
 * *****************************************************************************
 * Contributions to this work were made on behalf of the GÉANT project, a 
Severity: Minor
Found in web/lib/admin/API.php - About 5 hrs to fix

    Method scrub has 51 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function scrub($inputJson, $fedObject) {
            $optionInstance = \core\Options::instance();
            $parameters = [];
            $allPossibleAttribs = array_merge(API::ACTIONS[$inputJson['ACTION']]['REQ'], API::ACTIONS[$inputJson['ACTION']]['OPT']);
            // some actions don't need parameters. Don't get excited when there aren't any.
    Severity: Major
    Found in web/lib/admin/API.php - About 2 hrs to fix

      Method uglify has 39 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function uglify($parameters) {
              $coercedInline = [];
              $coercedFile = [];
              $optionObject = \core\Options::instance();
              $dir = \core\common\Entity::createTemporaryDirectory('test');
      Severity: Minor
      Found in web/lib/admin/API.php - About 1 hr to fix

        Function uglify has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

            public function uglify($parameters) {
                $coercedInline = [];
                $coercedFile = [];
                $optionObject = \core\Options::instance();
                $dir = \core\common\Entity::createTemporaryDirectory('test');
        Severity: Minor
        Found in web/lib/admin/API.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

        Avoid too many return statements within this method.
        Open

                return [$idp, $profile];
        Severity: Major
        Found in web/lib/admin/API.php - About 30 mins to fix

          There are no issues that match your filters.

          Category
          Status