modxcms/revolution

View on GitHub
manager/controllers/default/resource/resource.class.php

Summary

Maintainability
F
3 days
Test Coverage

Function loadTVs has a Cognitive Complexity of 66 (exceeds 5 allowed). Consider refactoring.
Open

    public function loadTVs($reloadData = array()) {
        $this->setPlaceholder('wctx',$this->resource->get('context_key'));
        $_GET['wctx'] = $this->resource->get('context_key');

        $this->fireOnTVFormRender();
Severity: Minor
Found in manager/controllers/default/resource/resource.class.php - About 1 day 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 loadTVs has 127 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function loadTVs($reloadData = array()) {
        $this->setPlaceholder('wctx',$this->resource->get('context_key'));
        $_GET['wctx'] = $this->resource->get('context_key');

        $this->fireOnTVFormRender();
Severity: Major
Found in manager/controllers/default/resource/resource.class.php - About 5 hrs to fix

    File resource.class.php has 359 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    /*
     * This file is part of MODX Revolution.
     *
     * Copyright (c) MODX, LLC. All Rights Reserved.
    Severity: Minor
    Found in manager/controllers/default/resource/resource.class.php - About 4 hrs to fix

      Function getInstance has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function getInstance(modX &$modx,$className,array $config = array()) {
              $resourceClass = 'modDocument';
              $isDerivative = false;
              if (!empty($_REQUEST['class_key'])) {
                  $isDerivative = true;
      Severity: Minor
      Found in manager/controllers/default/resource/resource.class.php - About 2 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

      Function getReloadData has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

          protected function getReloadData() {
              $modx =& $this->modx;
              $scriptProperties =& $this->scriptProperties;
              $reloadData = array();
      
      
      Severity: Minor
      Found in manager/controllers/default/resource/resource.class.php - About 2 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

      Method getInstance has 36 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public static function getInstance(modX &$modx,$className,array $config = array()) {
              $resourceClass = 'modDocument';
              $isDerivative = false;
              if (!empty($_REQUEST['class_key'])) {
                  $isDerivative = true;
      Severity: Minor
      Found in manager/controllers/default/resource/resource.class.php - About 1 hr to fix

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

            public function getResourceGroups() {
                $parentGroups = array();
                if ($this->resource->get('id') == 0) {
                    $parent = $this->modx->getObject('modResource',$this->resource->get('parent'));
                    /** @var modResource $parent */
        Severity: Minor
        Found in manager/controllers/default/resource/resource.class.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 getResourceGroups has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function getResourceGroups() {
                $parentGroups = array();
                if ($this->resource->get('id') == 0) {
                    $parent = $this->modx->getObject('modResource',$this->resource->get('parent'));
                    /** @var modResource $parent */
        Severity: Minor
        Found in manager/controllers/default/resource/resource.class.php - About 1 hr to fix

          There are no issues that match your filters.

          Category
          Status