GemsTracker/gemstracker-library

View on GitHub
classes/Gems/Menu/SubMenuItem.php

Summary

Maintainability
F
6 days
Test Coverage
D
69%

The method Gems_Menu_SubMenuItem::__toString() calls the typical debug function print_r() which is mostly only used during development.
Wontfix

        return print_r($this->_itemOptions, true);
Severity: Minor
Found in classes/Gems/Menu/SubMenuItem.php by phpmd

DevelopmentCodeFragment

Since: 2.3.0

Functions like vardump(), printr() etc. are normally only used during development and therefore such calls in production code are a good indicator that they were just forgotten.

Example

class SuspectCode {

    public function doSomething(array $items)
    {
        foreach ($items as $i => $item) {
            // …

            if ('qafoo' == $item) var_dump($i);

            // …
        }
    }
}

Source https://phpmd.org/rules/design.html#developmentcodefragment

The method Gems_Menu_SubMenuItem::_applyParameterFilter() calls the typical debug function print_r() which is mostly only used during development.
Open

                    \MUtil_Echo::r($name . ' => ' . print_r($testValue,true) . ' !== ' . $paramValue, $this->get('label') . ' (' . $this->get('controller') . '/' . $this->get('action') . ')');
Severity: Minor
Found in classes/Gems/Menu/SubMenuItem.php by phpmd

DevelopmentCodeFragment

Since: 2.3.0

Functions like vardump(), printr() etc. are normally only used during development and therefore such calls in production code are a good indicator that they were just forgotten.

Example

class SuspectCode {

    public function doSomething(array $items)
    {
        foreach ($items as $i => $item) {
            // …

            if ('qafoo' == $item) var_dump($i);

            // …
        }
    }
}

Source https://phpmd.org/rules/design.html#developmentcodefragment

File SubMenuItem.php has 625 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

/**
 *
 * @package    Gems
Severity: Major
Found in classes/Gems/Menu/SubMenuItem.php - About 1 day to fix

    Gems_Menu_SubMenuItem has 54 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Gems_Menu_SubMenuItem extends \Gems_Menu_MenuAbstract
    {
        private $_hiddenOrgId;
        private $_hiddenParameters = array();  // Added to $request by applyHiddenParameters
        private $_itemOptions;
    Severity: Major
    Found in classes/Gems/Menu/SubMenuItem.php - About 7 hrs to fix

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

          protected function _toRouteArray(\Gems_Menu_ParameterCollector $source)
          {
              if ($this->get('allowed')) {
                  $result = array();
                  if ($this->_applyParameterSources($source, $result, true)) {
      Severity: Minor
      Found in classes/Gems/Menu/SubMenuItem.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

      Function toActionLink has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
      Open

          public function toActionLink($parameterOrLabelSources_args = null)
          {
              if (!$this->get('allowed')) {
                  return null;
              }
      Severity: Minor
      Found in classes/Gems/Menu/SubMenuItem.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

      The class Gems_Menu_SubMenuItem has 27 public methods. Consider refactoring Gems_Menu_SubMenuItem to keep number of public methods under 10.
      Open

      class Gems_Menu_SubMenuItem extends \Gems_Menu_MenuAbstract
      {
          private $_hiddenOrgId;
          private $_hiddenParameters = array();  // Added to $request by applyHiddenParameters
          private $_itemOptions;
      Severity: Minor
      Found in classes/Gems/Menu/SubMenuItem.php by phpmd

      TooManyPublicMethods

      Since: 0.1

      A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

      By default it ignores methods starting with 'get' or 'set'.

      Example

      Source https://phpmd.org/rules/codesize.html#toomanypublicmethods

      The class Gems_Menu_SubMenuItem has an overall complexity of 162 which is very high. The configured complexity threshold is 50.
      Open

      class Gems_Menu_SubMenuItem extends \Gems_Menu_MenuAbstract
      {
          private $_hiddenOrgId;
          private $_hiddenParameters = array();  // Added to $request by applyHiddenParameters
          private $_itemOptions;
      Severity: Minor
      Found in classes/Gems/Menu/SubMenuItem.php by phpmd

      The class Gems_Menu_SubMenuItem has 39 non-getter- and setter-methods. Consider refactoring Gems_Menu_SubMenuItem to keep number of methods under 25.
      Open

      class Gems_Menu_SubMenuItem extends \Gems_Menu_MenuAbstract
      {
          private $_hiddenOrgId;
          private $_hiddenParameters = array();  // Added to $request by applyHiddenParameters
          private $_itemOptions;
      Severity: Minor
      Found in classes/Gems/Menu/SubMenuItem.php by phpmd

      TooManyMethods

      Since: 0.1

      A class with too many methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

      By default it ignores methods starting with 'get' or 'set'.

      The default was changed from 10 to 25 in PHPMD 2.3.

      Example

      Source https://phpmd.org/rules/codesize.html#toomanymethods

      Function _applyParameterFilter has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
      Open

          private function _applyParameterFilter(\Gems_Menu_ParameterCollector $source, $raiseConditions, &$condition)
          {
              foreach ($this->_parameterFilter as $name => $testValue) {
                  $paramValue = $source->getMenuParameter($name);
                  $testValue  = (array) $testValue;
      Severity: Minor
      Found in classes/Gems/Menu/SubMenuItem.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 toActionLink has 59 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function toActionLink($parameterOrLabelSources_args = null)
          {
              if (!$this->get('allowed')) {
                  return null;
              }
      Severity: Major
      Found in classes/Gems/Menu/SubMenuItem.php - About 2 hrs to fix

        Function checkParameterFilter has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
        Open

            public function checkParameterFilter($arrayOrKey1, $value1 = null)
            {
                $checks = \MUtil_Ra::pairs(func_get_args());
        
                foreach($checks as $name => $value) {
        Severity: Minor
        Found in classes/Gems/Menu/SubMenuItem.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 _toHRef has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

            private function _toHRef(\Gems_Menu_ParameterCollector $source, &$condition)
            {
                if ($this->get('allowed')) {
                    $parameters = array();
        
        
        Severity: Minor
        Found in classes/Gems/Menu/SubMenuItem.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 _applyParameterSources has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

            private function _applyParameterSources(\Gems_Menu_ParameterCollector $source, array &$parameters, $raiseConditions)
            {
                // \Gems_Menu::$verbose = true;
                // \MUtil_Echo::r($this->get('label'));
                $condition = true;
        Severity: Minor
        Found in classes/Gems/Menu/SubMenuItem.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 _toRouteArray has 33 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected function _toRouteArray(\Gems_Menu_ParameterCollector $source)
            {
                if ($this->get('allowed')) {
                    $result = array();
                    if ($this->_applyParameterSources($source, $result, true)) {
        Severity: Minor
        Found in classes/Gems/Menu/SubMenuItem.php - About 1 hr to fix

          Method _applyParameterFilter has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private function _applyParameterFilter(\Gems_Menu_ParameterCollector $source, $raiseConditions, &$condition)
              {
                  foreach ($this->_parameterFilter as $name => $testValue) {
                      $paramValue = $source->getMenuParameter($name);
                      $testValue  = (array) $testValue;
          Severity: Minor
          Found in classes/Gems/Menu/SubMenuItem.php - About 1 hr to fix

            Avoid deeply nested control flow statements.
            Open

                                        if ($child->check(array('allowed', true))) {
                                            $firstChild = $firstChild->toRouteArray($source);
                                            break;
                                        }
            Severity: Major
            Found in classes/Gems/Menu/SubMenuItem.php - About 45 mins to fix

              Function addDeReactivateAction has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function addDeReactivateAction($checkField, $deactivateOn = 1, $reactivateOn = 1, array $otherDeact = array(), array $otherReact = array())
                  {
                      $pages = array();
              
                      if (null !== $deactivateOn) {
              Severity: Minor
              Found in classes/Gems/Menu/SubMenuItem.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

              Method addDeReactivateAction has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  public function addDeReactivateAction($checkField, $deactivateOn = 1, $reactivateOn = 1, array $otherDeact = array(), array $otherReact = array())
              Severity: Minor
              Found in classes/Gems/Menu/SubMenuItem.php - About 35 mins to fix

                Method addPdfButton has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    public function addPdfButton($label, $privilege, $controller = null, $action = 'pdf', array $other = array())
                Severity: Minor
                Found in classes/Gems/Menu/SubMenuItem.php - About 35 mins to fix

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

                      public function applyHiddenParameters(\Zend_Controller_Request_Abstract $request, \Gems_Menu_ParameterSource $source)
                      {
                          foreach ($this->_hiddenParameters as $key => $value) {
                              $request->setParam($key, $value);
                              $source[$key] = $value;
                  Severity: Minor
                  Found in classes/Gems/Menu/SubMenuItem.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 toUl has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function toUl($actionController = null)
                      {
                          if (!$this->isVisible() || !$this->hasChildren()) {
                              return null;
                          }
                  Severity: Minor
                  Found in classes/Gems/Menu/SubMenuItem.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

                  The method toActionLink() has an NPath complexity of 5712. The configured NPath complexity threshold is 200.
                  Open

                      public function toActionLink($parameterOrLabelSources_args = null)
                      {
                          if (!$this->get('allowed')) {
                              return null;
                          }
                  Severity: Minor
                  Found in classes/Gems/Menu/SubMenuItem.php by phpmd

                  NPathComplexity

                  Since: 0.1

                  The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

                  Example

                  class Foo {
                      function bar() {
                          // lots of complicated code
                      }
                  }

                  Source https://phpmd.org/rules/codesize.html#npathcomplexity

                  The class Gems_Menu_SubMenuItem has 1060 lines of code. Current threshold is 1000. Avoid really long classes.
                  Open

                  class Gems_Menu_SubMenuItem extends \Gems_Menu_MenuAbstract
                  {
                      private $_hiddenOrgId;
                      private $_hiddenParameters = array();  // Added to $request by applyHiddenParameters
                      private $_itemOptions;
                  Severity: Minor
                  Found in classes/Gems/Menu/SubMenuItem.php by phpmd

                  The method toActionLink() has a Cyclomatic Complexity of 20. The configured cyclomatic complexity threshold is 10.
                  Open

                      public function toActionLink($parameterOrLabelSources_args = null)
                      {
                          if (!$this->get('allowed')) {
                              return null;
                          }
                  Severity: Minor
                  Found in classes/Gems/Menu/SubMenuItem.php by phpmd

                  CyclomaticComplexity

                  Since: 0.1

                  Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

                  Example

                  // Cyclomatic Complexity = 11
                  class Foo {
                  1   public function example() {
                  2       if ($a == $b) {
                  3           if ($a1 == $b1) {
                                  fiddle();
                  4           } elseif ($a2 == $b2) {
                                  fiddle();
                              } else {
                                  fiddle();
                              }
                  5       } elseif ($c == $d) {
                  6           while ($c == $d) {
                                  fiddle();
                              }
                  7        } elseif ($e == $f) {
                  8           for ($n = 0; $n < $h; $n++) {
                                  fiddle();
                              }
                          } else {
                              switch ($z) {
                  9               case 1:
                                      fiddle();
                                      break;
                  10              case 2:
                                      fiddle();
                                      break;
                  11              case 3:
                                      fiddle();
                                      break;
                                  default:
                                      fiddle();
                                      break;
                              }
                          }
                      }
                  }

                  Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

                  The method _toRouteArray() has a Cyclomatic Complexity of 12. The configured cyclomatic complexity threshold is 10.
                  Open

                      protected function _toRouteArray(\Gems_Menu_ParameterCollector $source)
                      {
                          if ($this->get('allowed')) {
                              $result = array();
                              if ($this->_applyParameterSources($source, $result, true)) {
                  Severity: Minor
                  Found in classes/Gems/Menu/SubMenuItem.php by phpmd

                  CyclomaticComplexity

                  Since: 0.1

                  Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

                  Example

                  // Cyclomatic Complexity = 11
                  class Foo {
                  1   public function example() {
                  2       if ($a == $b) {
                  3           if ($a1 == $b1) {
                                  fiddle();
                  4           } elseif ($a2 == $b2) {
                                  fiddle();
                              } else {
                                  fiddle();
                              }
                  5       } elseif ($c == $d) {
                  6           while ($c == $d) {
                                  fiddle();
                              }
                  7        } elseif ($e == $f) {
                  8           for ($n = 0; $n < $h; $n++) {
                                  fiddle();
                              }
                          } else {
                              switch ($z) {
                  9               case 1:
                                      fiddle();
                                      break;
                  10              case 2:
                                      fiddle();
                                      break;
                  11              case 3:
                                      fiddle();
                                      break;
                                  default:
                                      fiddle();
                                      break;
                              }
                          }
                      }
                  }

                  Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

                  The class Gems_Menu_SubMenuItem has a coupling between objects value of 18. Consider to reduce the number of dependencies under 13.
                  Open

                  class Gems_Menu_SubMenuItem extends \Gems_Menu_MenuAbstract
                  {
                      private $_hiddenOrgId;
                      private $_hiddenParameters = array();  // Added to $request by applyHiddenParameters
                      private $_itemOptions;
                  Severity: Minor
                  Found in classes/Gems/Menu/SubMenuItem.php by phpmd

                  CouplingBetweenObjects

                  Since: 1.1.0

                  A class with too many dependencies has negative impacts on several quality aspects of a class. This includes quality criteria like stability, maintainability and understandability

                  Example

                  class Foo {
                      /**
                       * @var \foo\bar\X
                       */
                      private $x = null;
                  
                      /**
                       * @var \foo\bar\Y
                       */
                      private $y = null;
                  
                      /**
                       * @var \foo\bar\Z
                       */
                      private $z = null;
                  
                      public function setFoo(\Foo $foo) {}
                      public function setBar(\Bar $bar) {}
                      public function setBaz(\Baz $baz) {}
                  
                      /**
                       * @return \SplObjectStorage
                       * @throws \OutOfRangeException
                       * @throws \InvalidArgumentException
                       * @throws \ErrorException
                       */
                      public function process(\Iterator $it) {}
                  
                      // ...
                  }

                  Source https://phpmd.org/rules/design.html#couplingbetweenobjects

                  Avoid unused private methods such as '_toLi'.
                  Open

                      private function _toLi(\Gems_Menu_ParameterCollector $source)
                      {
                          $condition = false;
                          if ($href = $this->_toHRef($source, $condition)) {
                              $li = \MUtil_Html::create()->li();
                  Severity: Minor
                  Found in classes/Gems/Menu/SubMenuItem.php by phpmd

                  UnusedPrivateMethod

                  Since: 0.2

                  Unused Private Method detects when a private method is declared but is unused.

                  Example

                  class Something
                  {
                      private function foo() {} // unused
                  }

                  Source https://phpmd.org/rules/unusedcode.html#unusedprivatemethod

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                      public function addDeleteAction($privilege = null, array $other = array())
                      {
                          if (isset($other['label'])) {
                              $label = $other['label'];
                              unset($other['label']);
                  Severity: Major
                  Found in classes/Gems/Menu/SubMenuItem.php and 1 other location - About 2 hrs to fix
                  classes/Gems/Menu/SubMenuItem.php on lines 453..470

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 128.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                      public function addEditAction($privilege = null, array $other = array())
                      {
                          if (isset($other['label'])) {
                              $label = $other['label'];
                              unset($other['label']);
                  Severity: Major
                  Found in classes/Gems/Menu/SubMenuItem.php and 1 other location - About 2 hrs to fix
                  classes/Gems/Menu/SubMenuItem.php on lines 427..444

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 128.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                          if (null !== $reactivateOn) {
                              if (isset($otherReact['privilege'])) {
                                  $privilege = $otherReact['privilege'];
                              } else {
                                  $privilege = $this->get('privilege') . '.reactivate';
                  Severity: Major
                  Found in classes/Gems/Menu/SubMenuItem.php and 1 other location - About 1 hr to fix
                  classes/Gems/Menu/SubMenuItem.php on lines 390..401

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 111.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                          if (null !== $deactivateOn) {
                              if (isset($otherDeact['privilege'])) {
                                  $privilege = $otherDeact['privilege'];
                              } else {
                                  $privilege = $this->get('privilege') . '.deactivate';
                  Severity: Major
                  Found in classes/Gems/Menu/SubMenuItem.php and 1 other location - About 1 hr to fix
                  classes/Gems/Menu/SubMenuItem.php on lines 403..414

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 111.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Avoid excessively long variable names like $parameterOrLabelSources_args. Keep variable name length under 20.
                  Open

                      public function toActionLink($parameterOrLabelSources_args = null)
                  Severity: Minor
                  Found in classes/Gems/Menu/SubMenuItem.php by phpmd

                  LongVariable

                  Since: 0.2

                  Detects when a field, formal or local variable is declared with a long name.

                  Example

                  class Something {
                      protected $reallyLongIntName = -3; // VIOLATION - Field
                      public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
                          $otherReallyLongName = -5; // VIOLATION - Local
                          for ($interestingIntIndex = 0; // VIOLATION - For
                               $interestingIntIndex < 10;
                               $interestingIntIndex++ ) {
                          }
                      }
                  }

                  Source https://phpmd.org/rules/naming.html#longvariable

                  Avoid using short method names like Gems_Menu_SubMenuItem::is(). The configured minimum method name length is 3.
                  Open

                      public function is($key, $value)
                      {
                          // \MUtil_Echo::track($key, $value);
                          $target = $this->get($key);
                  
                  
                  Severity: Minor
                  Found in classes/Gems/Menu/SubMenuItem.php by phpmd

                  ShortMethodName

                  Since: 0.2

                  Detects when very short method names are used.

                  Example

                  class ShortMethod {
                      public function a( $index ) { // Violation
                      }
                  }

                  Source https://phpmd.org/rules/naming.html#shortmethodname

                  Avoid variables with short names like $li. Configured minimum length is 3.
                  Open

                              if ($li = $menuItem->_toLi(new \Gems_Menu_ParameterCollector($parameterSources))) {
                  Severity: Minor
                  Found in classes/Gems/Menu/SubMenuItem.php by phpmd

                  ShortVariable

                  Since: 0.2

                  Detects when a field, local, or parameter has a very short name.

                  Example

                  class Something {
                      private $q = 15; // VIOLATION - Field
                      public static function main( array $as ) { // VIOLATION - Formal
                          $r = 20 + $this->q; // VIOLATION - Local
                          for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                              $r += $this->q;
                          }
                      }
                  }

                  Source https://phpmd.org/rules/naming.html#shortvariable

                  Avoid variables with short names like $ul. Configured minimum length is 3.
                  Open

                          $ul = \MUtil_Html_ListElement::ul();
                  Severity: Minor
                  Found in classes/Gems/Menu/SubMenuItem.php by phpmd

                  ShortVariable

                  Since: 0.2

                  Detects when a field, local, or parameter has a very short name.

                  Example

                  class Something {
                      private $q = 15; // VIOLATION - Field
                      public static function main( array $as ) { // VIOLATION - Formal
                          $r = 20 + $this->q; // VIOLATION - Local
                          for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                              $r += $this->q;
                          }
                      }
                  }

                  Source https://phpmd.org/rules/naming.html#shortvariable

                  Avoid variables with short names like $li. Configured minimum length is 3.
                  Open

                              $li = \MUtil_Html::create()->li();
                  Severity: Minor
                  Found in classes/Gems/Menu/SubMenuItem.php by phpmd

                  ShortVariable

                  Since: 0.2

                  Detects when a field, local, or parameter has a very short name.

                  Example

                  class Something {
                      private $q = 15; // VIOLATION - Field
                      public static function main( array $as ) { // VIOLATION - Formal
                          $r = 20 + $this->q; // VIOLATION - Local
                          for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                              $r += $this->q;
                          }
                      }
                  }

                  Source https://phpmd.org/rules/naming.html#shortvariable

                  The parameter $parameterOrLabelSources_args is not named in camelCase.
                  Open

                      public function toActionLink($parameterOrLabelSources_args = null)
                      {
                          if (!$this->get('allowed')) {
                              return null;
                          }
                  Severity: Minor
                  Found in classes/Gems/Menu/SubMenuItem.php by phpmd

                  CamelCaseParameterName

                  Since: 0.2

                  It is considered best practice to use the camelCase notation to name parameters.

                  Example

                  class ClassName {
                      public function doSomething($user_name) {
                      }
                  }

                  Source

                  There are no issues that match your filters.

                  Category
                  Status