GemsTracker/gemstracker-library

View on GitHub
classes/OpenRosa/Tracker/Source/Form.php

Summary

Maintainability
F
1 wk
Test Coverage

Function getModel has a Cognitive Complexity of 97 (exceeds 5 allowed). Consider refactoring.
Open

    public function getModel()
    {
        if (empty($this->model)) {
            try {
                $model = new \Gems_Model_JoinModel($this->getFormID(), $this->getTableName(), 'orf');
Severity: Minor
Found in classes/OpenRosa/Tracker/Source/Form.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

File Form.php has 623 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * Helper for OpenRosa forms
 *
 * It supports a subset of OpenRosa forms and provides a bridge between GemsTracker
Severity: Major
Found in classes/OpenRosa/Tracker/Source/Form.php - About 1 day to fix

    Method getModel has 134 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function getModel()
        {
            if (empty($this->model)) {
                try {
                    $model = new \Gems_Model_JoinModel($this->getFormID(), $this->getTableName(), 'orf');
    Severity: Major
    Found in classes/OpenRosa/Tracker/Source/Form.php - About 5 hrs to fix

      Function flattenBody has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
      Open

          private function flattenBody($xml, $context = '')
          {
              foreach ($xml as $elementName => $element) {
                  //Check ref first
                  $elementContext = $context;
      Severity: Minor
      Found in classes/OpenRosa/Tracker/Source/Form.php - About 4 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 createTable has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
      Open

          private function createTable()
          {
              $nested      = false;
      
              $mainTableName   = $this->getTableName();
      Severity: Minor
      Found in classes/OpenRosa/Tracker/Source/Form.php - About 4 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 createTable has 103 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private function createTable()
          {
              $nested      = false;
      
              $mainTableName   = $this->getTableName();
      Severity: Major
      Found in classes/OpenRosa/Tracker/Source/Form.php - About 4 hrs to fix

        Function saveAnswer has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
        Open

            public function saveAnswer($file, $remove = true)
            {
                if (!file_exists($file)) {
                    throw new \Gems_Exception_Coding(sprintf($this->translate->_('File not found: %s'), $file));
                }
        Severity: Minor
        Found in classes/OpenRosa/Tracker/Source/Form.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

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

        class Form
        {
            /**
             * @var \Gems_Model_JoinModel
             */

        Method flattenBody has 69 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private function flattenBody($xml, $context = '')
            {
                foreach ($xml as $elementName => $element) {
                    //Check ref first
                    $elementContext = $context;
        Severity: Major
        Found in classes/OpenRosa/Tracker/Source/Form.php - About 2 hrs to fix

          Form has 22 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class Form
          {
              /**
               * @var \Gems_Model_JoinModel
               */
          Severity: Minor
          Found in classes/OpenRosa/Tracker/Source/Form.php - About 2 hrs to fix

            Function getDeviceIdField has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
            Open

                public function getDeviceIdField()
                {
                    if (empty($this->deviceIdField)) {
                        foreach ($this->_xml->children('h', true)->head->children()->model->bind as $bind) {
                            if ($presets = $bind->attributes('jr', true)) {
            Severity: Minor
            Found in classes/OpenRosa/Tracker/Source/Form.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 saveAnswer has 50 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function saveAnswer($file, $remove = true)
                {
                    if (!file_exists($file)) {
                        throw new \Gems_Exception_Coding(sprintf($this->translate->_('File not found: %s'), $file));
                    }
            Severity: Minor
            Found in classes/OpenRosa/Tracker/Source/Form.php - About 2 hrs to fix

              Method _processAnswer has 34 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  protected function _processAnswer($key, $input, $type)
                  {
                      $output    = array();
                      $modelName = str_replace('/', '_', $key);
              
              
              Severity: Minor
              Found in classes/OpenRosa/Tracker/Source/Form.php - About 1 hr to fix

                Function flattenAnswers has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                    private function flattenAnswers($xml, $parent = '')
                    {
                        $output = array();
                        $model = $this->getModel();
                        foreach ($xml as $name => $element) {
                Severity: Minor
                Found in classes/OpenRosa/Tracker/Source/Form.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 _processAnswer has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                    protected function _processAnswer($key, $input, $type)
                    {
                        $output    = array();
                        $modelName = str_replace('/', '_', $key);
                
                
                Severity: Minor
                Found in classes/OpenRosa/Tracker/Source/Form.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 deeply nested control flow statements.
                Open

                                                if (array_key_exists('hint', $this->body[$bindName])) {
                                                    $label = sprintf('%s (%s)', $label, $this->body[$bindName]['hint']);
                                                }
                Severity: Major
                Found in classes/OpenRosa/Tracker/Source/Form.php - About 45 mins to fix

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

                      private function flattenBind($xml)
                      {
                          foreach ($xml as $name => $element) {
                              $attributes = array();
                              foreach ($element->attributes() as $name => $value) {
                  Severity: Minor
                  Found in classes/OpenRosa/Tracker/Source/Form.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

                  Avoid deeply nested control flow statements.
                  Open

                                                  if ($found['preloadParams'] == 'start') {
                                                      $label = $this->translate->_('Start date');
                                                      $modelToUse->setMeta('start', $modelName);
                                                  } elseif ($found['preloadParams'] == 'end') {
                                                      $label = $this->translate->_('Completion date');
                  Severity: Major
                  Found in classes/OpenRosa/Tracker/Source/Form.php - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                                    if (substr($mediaType, 0, 5) == 'image') {
                                                        $modelToUse->setOnLoad($modelName, array($this,'formatImg'));
                                                    }
                    Severity: Major
                    Found in classes/OpenRosa/Tracker/Source/Form.php - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                                      if (array_key_exists('hint', $this->body[$bindName])) {
                                                          $label = sprintf('%s (%s)', $label, $this->body[$bindName]['hint']);
                                                      }
                      Severity: Major
                      Found in classes/OpenRosa/Tracker/Source/Form.php - About 45 mins to fix

                        Function flattenInstance has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                        Open

                            private function flattenInstance($xml, $parent = '')
                            {
                                $output = array();
                                foreach ($xml as $name => $element) {
                                    if (!empty($parent)) {
                        Severity: Minor
                        Found in classes/OpenRosa/Tracker/Source/Form.php - About 35 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 getFormID has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function getFormID()
                            {
                                if (empty($this->formID)) {
                                    foreach ($this->_xml->children('h', true)->head->children()->model->instance->children() as $element) {
                                        if (!empty($element->attributes()->id)) {
                        Severity: Minor
                        Found in classes/OpenRosa/Tracker/Source/Form.php - About 35 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 getFormVersion has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function getFormVersion()
                            {
                                if (empty($this->formVersion)) {
                                    foreach ($this->_xml->children('h', true)->head->children()->model->instance->children() as $element) {
                                        if (!empty($element->attributes()->version)) {
                        Severity: Minor
                        Found in classes/OpenRosa/Tracker/Source/Form.php - About 35 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 getModel() has an NPath complexity of 5551. The configured NPath complexity threshold is 200.
                        Open

                            public function getModel()
                            {
                                if (empty($this->model)) {
                                    try {
                                        $model = new \Gems_Model_JoinModel($this->getFormID(), $this->getTableName(), 'orf');

                        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 method getModel() has 171 lines of code. Current threshold is set to 100. Avoid really long methods.
                        Open

                            public function getModel()
                            {
                                if (empty($this->model)) {
                                    try {
                                        $model = new \Gems_Model_JoinModel($this->getFormID(), $this->getTableName(), 'orf');

                        The method createTable() has 139 lines of code. Current threshold is set to 100. Avoid really long methods.
                        Open

                            private function createTable()
                            {
                                $nested      = false;
                        
                                $mainTableName   = $this->getTableName();

                        The method saveAnswer() has an NPath complexity of 720. The configured NPath complexity threshold is 200.
                        Open

                            public function saveAnswer($file, $remove = true)
                            {
                                if (!file_exists($file)) {
                                    throw new \Gems_Exception_Coding(sprintf($this->translate->_('File not found: %s'), $file));
                                }

                        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 method createTable() has an NPath complexity of 1884. The configured NPath complexity threshold is 200.
                        Open

                            private function createTable()
                            {
                                $nested      = false;
                        
                                $mainTableName   = $this->getTableName();

                        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 method flattenBody() has a Cyclomatic Complexity of 21. The configured cyclomatic complexity threshold is 10.
                        Open

                            private function flattenBody($xml, $context = '')
                            {
                                foreach ($xml as $elementName => $element) {
                                    //Check ref first
                                    $elementContext = $context;

                        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 getModel() has a Cyclomatic Complexity of 36. The configured cyclomatic complexity threshold is 10.
                        Open

                            public function getModel()
                            {
                                if (empty($this->model)) {
                                    try {
                                        $model = new \Gems_Model_JoinModel($this->getFormID(), $this->getTableName(), 'orf');

                        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 createTable() has a Cyclomatic Complexity of 22. The configured cyclomatic complexity threshold is 10.
                        Open

                            private function createTable()
                            {
                                $nested      = false;
                        
                                $mainTableName   = $this->getTableName();

                        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 saveAnswer() has a Cyclomatic Complexity of 14. The configured cyclomatic complexity threshold is 10.
                        Open

                            public function saveAnswer($file, $remove = true)
                            {
                                if (!file_exists($file)) {
                                    throw new \Gems_Exception_Coding(sprintf($this->translate->_('File not found: %s'), $file));
                                }

                        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 Form has a coupling between objects value of 17. Consider to reduce the number of dependencies under 13.
                        Open

                        class Form
                        {
                            /**
                             * @var \Gems_Model_JoinModel
                             */

                        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 local variables such as '$idx'.
                        Open

                                        foreach ($items as $idx => $answer) {

                        UnusedLocalVariable

                        Since: 0.2

                        Detects when a local variable is declared and/or assigned, but not used.

                        Example

                        class Foo {
                            public function doSomething()
                            {
                                $i = 5; // Unused
                            }
                        }

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

                        Avoid unused local variables such as '$element'.
                        Open

                                foreach ($this->instance as $name => $element) {

                        UnusedLocalVariable

                        Since: 0.2

                        Detects when a local variable is declared and/or assigned, but not used.

                        Example

                        class Foo {
                            public function doSomething()
                            {
                                $i = 5; // Unused
                            }
                        }

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

                        Avoid unused local variables such as '$model'.
                        Open

                                    $model = $this->createTable();

                        UnusedLocalVariable

                        Since: 0.2

                        Detects when a local variable is declared and/or assigned, but not used.

                        Example

                        class Foo {
                            public function doSomething()
                            {
                                $i = 5; // Unused
                            }
                        }

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

                        Avoid unused parameters such as '$new'.
                        Open

                            public function formatImg($value, $new, $name, array $context = array())

                        UnusedFormalParameter

                        Since: 0.2

                        Avoid passing parameters to methods or constructors and then not using those parameters.

                        Example

                        class Foo
                        {
                            private function bar($howdy)
                            {
                                // $howdy is not used
                            }
                        }

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

                        Avoid unused parameters such as '$name'.
                        Open

                            public function formatImg($value, $new, $name, array $context = array())

                        UnusedFormalParameter

                        Since: 0.2

                        Avoid passing parameters to methods or constructors and then not using those parameters.

                        Example

                        class Foo
                        {
                            private function bar($howdy)
                            {
                                // $howdy is not used
                            }
                        }

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

                        Avoid using empty try-catch blocks in testTable.
                        Open

                                } catch (\Exception $exc) {
                        
                                }

                        EmptyCatchBlock

                        Since: 2.7.0

                        Usually empty try-catch is a bad idea because you are silently swallowing an error condition and then continuing execution. Occasionally this may be the right thing to do, but often it's a sign that a developer saw an exception, didn't know what to do about it, and so used an empty catch to silence the problem.

                        Example

                        class Foo {
                        
                          public function bar()
                          {
                              try {
                                  // ...
                              } catch (Exception $e) {} // empty catch block
                          }
                        }

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

                        Avoid unused local variables such as '$key'.
                        Open

                                                foreach($subarray as $key => &$info)

                        UnusedLocalVariable

                        Since: 0.2

                        Detects when a local variable is declared and/or assigned, but not used.

                        Example

                        class Foo {
                            public function doSomething()
                            {
                                $i = 5; // Unused
                            }
                        }

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

                        Avoid unused local variables such as '$element'.
                        Open

                                    foreach ($this->instance as $name => $element) {

                        UnusedLocalVariable

                        Since: 0.2

                        Detects when a local variable is declared and/or assigned, but not used.

                        Example

                        class Foo {
                            public function doSomething()
                            {
                                $i = 5; // Unused
                            }
                        }

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

                        Avoid unused local variables such as '$element'.
                        Open

                                foreach($this->instance as $name => $element) {

                        UnusedLocalVariable

                        Since: 0.2

                        Detects when a local variable is declared and/or assigned, but not used.

                        Example

                        class Foo {
                            public function doSomething()
                            {
                                $i = 5; // Unused
                            }
                        }

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

                        TODO found
                        Open

                                // @@TODO: make hook for respondentID lookup too

                        TODO found
                        Open

                                // TODO: Find a way to build an url that identifies the form so we can download the attachted image

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

                            public function __construct($file, \Zend_Db_Adapter_Abstract $db, \Zend_Translate $translate)

                        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 $db. Configured minimum length is 3.
                        Open

                                $db = \Zend_Registry::getInstance()->get('db');

                        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 $db. Configured minimum length is 3.
                        Open

                            protected $db;

                        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

                        There are no issues that match your filters.

                        Category
                        Status