modxcms/revolution

View on GitHub
core/model/modx/modmanagerresponse.class.php

Summary

Maintainability
C
1 day
Test Coverage

Function loadControllerClass has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

    public function loadControllerClass($prefixNamespace = true) {
        $theme = $this->modx->getOption('manager_theme',null,'default');
        $paths = $this->getNamespacePath($theme);
        $f = $this->action['controller'];
        $className = $this->getControllerClassName();
Severity: Minor
Found in core/model/modx/modmanagerresponse.class.php - About 3 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 outputContent has 40 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function outputContent(array $options = array()) {
        $route = $this->modx->request->action;
        $this->namespace = $this->modx->request->namespace;
        if (empty($route)) {
            $route = $this->namespace == 'core' ? 'welcome' : 'index';
Severity: Minor
Found in core/model/modx/modmanagerresponse.class.php - About 1 hr to fix

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

        public function loadControllerClass($prefixNamespace = true) {
            $theme = $this->modx->getOption('manager_theme',null,'default');
            $paths = $this->getNamespacePath($theme);
            $f = $this->action['controller'];
            $className = $this->getControllerClassName();
    Severity: Minor
    Found in core/model/modx/modmanagerresponse.class.php - About 1 hr to fix

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

          public function checkForMenuPermissions($action) {
              $canAccess = true;
              /** @var modMenu $menu */
              $menu = $this->modx->getObject('modMenu', array(
                  'action' => $action,
      Severity: Minor
      Found in core/model/modx/modmanagerresponse.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

      Function getNamespacePath has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          public function getNamespacePath($theme = 'default') {
              $namespace = array_key_exists($this->namespace,$this->namespaces) ? $this->namespaces[$this->namespace] : $this->namespaces['core'];
              /* find context path */
              if (isset($namespace['name']) && $namespace['name'] != 'core') {
                  $paths[] = $namespace['path'].'controllers/'.trim($theme,'/').'/';
      Severity: Minor
      Found in core/model/modx/modmanagerresponse.class.php - About 55 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 outputContent has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          public function outputContent(array $options = array()) {
              $route = $this->modx->request->action;
              $this->namespace = $this->modx->request->namespace;
              if (empty($route)) {
                  $route = $this->namespace == 'core' ? 'welcome' : 'index';
      Severity: Minor
      Found in core/model/modx/modmanagerresponse.class.php - About 45 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 validateAuthentication has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          public function validateAuthentication() {
              $isLoggedIn = $this->modx->user->isAuthenticated('mgr');
              if (!$isLoggedIn) {
                  $alternateLogin = $this->modx->getOption('manager_login_url_alternate',null,'');
                  if (!empty($alternateLogin)) {
      Severity: Minor
      Found in core/model/modx/modmanagerresponse.class.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

      There are no issues that match your filters.

      Category
      Status