core/modules/_core/_coreCrudController.php

Summary

Maintainability
F
6 days
Test Coverage

submission accesses the super-global variable $_SERVER.
Open

    private function submission($crudId, $id)
    {
        $session = new Ajde_Session('AC.Crud');

        /* @var $crud Ajde_Crud */

Superglobals

Since: 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example

class Foo {
    public function bar() {
        $name = $_POST['foo'];
    }
}

Source

File _coreCrudController.php has 584 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

/**
 * Default to extend Ajde_Acl_Controller for enhanced security.
 */
Severity: Major
Found in core/modules/_core/_coreCrudController.php - About 1 day to fix

    Function addMultiple has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
    Open

        private function addMultiple($crudId, $id, $parentId = null, $fieldName = null)
        {
            /* @var $crud Ajde_Crud */
            if ($crudId instanceof Ajde_Crud) {
                $crud = $crudId;
    Severity: Minor
    Found in core/modules/_core/_coreCrudController.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 sort has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
    Open

        private function sort($crudId, $id)
        {
            $session = new Ajde_Session('AC.Crud');
            /* @var $crud Ajde_Crud */
            $crud = $session->getModel($crudId);
    Severity: Minor
    Found in core/modules/_core/_coreCrudController.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

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

    class _coreCrudController extends Ajde_Acl_Controller
    {
        /************************
         * Ajde_Component_Crud
         ************************/

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

        public function editDefault()
        {
            $this->setAction('edit');
    
            $crud = $this->getCrudInstance();
    Severity: Minor
    Found in core/modules/_core/_coreCrudController.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 sort has 76 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private function sort($crudId, $id)
        {
            $session = new Ajde_Session('AC.Crud');
            /* @var $crud Ajde_Crud */
            $crud = $session->getModel($crudId);
    Severity: Major
    Found in core/modules/_core/_coreCrudController.php - About 3 hrs to fix

      Method addMultiple has 75 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private function addMultiple($crudId, $id, $parentId = null, $fieldName = null)
          {
              /* @var $crud Ajde_Crud */
              if ($crudId instanceof Ajde_Crud) {
                  $crud = $crudId;
      Severity: Major
      Found in core/modules/_core/_coreCrudController.php - About 3 hrs to fix

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

            private function save($crudId, $id)
            {
                $session = new Ajde_Session('AC.Crud');
        
                /* @var $crud Ajde_Crud */
        Severity: Minor
        Found in core/modules/_core/_coreCrudController.php - About 2 hrs to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

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

            private function deleteMultiple($crudId, $id, $parentId = null, $fieldName = null, $all = false)
            {
                /* @var $crud Ajde_Crud */
                if ($crudId instanceof Ajde_Crud) {
                    $crud = $crudId;
        Severity: Minor
        Found in core/modules/_core/_coreCrudController.php - About 2 hrs to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Function getMultipleRow has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
        Open

            private function getMultipleRow($crudId)
            {
                $session = new Ajde_Session('AC.Crud');
                /* @var $crud Ajde_Crud */
                $crud = $session->getModel($crudId);
        Severity: Minor
        Found in core/modules/_core/_coreCrudController.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 editDefault has 66 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function editDefault()
            {
                $this->setAction('edit');
        
                $crud = $this->getCrudInstance();
        Severity: Major
        Found in core/modules/_core/_coreCrudController.php - About 2 hrs to fix

          Method submission has 59 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private function submission($crudId, $id)
              {
                  $session = new Ajde_Session('AC.Crud');
          
                  /* @var $crud Ajde_Crud */
          Severity: Major
          Found in core/modules/_core/_coreCrudController.php - About 2 hrs to fix

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

                private function deleteMultiple($crudId, $id, $parentId = null, $fieldName = null, $all = false)
                {
                    /* @var $crud Ajde_Crud */
                    if ($crudId instanceof Ajde_Crud) {
                        $crud = $crudId;
            Severity: Major
            Found in core/modules/_core/_coreCrudController.php - About 2 hrs to fix

              Method getMultipleRow has 50 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  private function getMultipleRow($crudId)
                  {
                      $session = new Ajde_Session('AC.Crud');
                      /* @var $crud Ajde_Crud */
                      $crud = $session->getModel($crudId);
              Severity: Minor
              Found in core/modules/_core/_coreCrudController.php - About 2 hrs to fix

                Method save has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    private function save($crudId, $id)
                    {
                        $session = new Ajde_Session('AC.Crud');
                
                        /* @var $crud Ajde_Crud */
                Severity: Minor
                Found in core/modules/_core/_coreCrudController.php - About 1 hr to fix

                  Method commitJson has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function commitJson()
                      {
                          $operation = Ajde::app()->getRequest()->getParam('operation');
                          $crudId = Ajde::app()->getRequest()->getParam('crudId');
                          $id = Ajde::app()->getRequest()->getPostParam('id', false);
                  Severity: Minor
                  Found in core/modules/_core/_coreCrudController.php - About 1 hr to fix

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

                        public function commitJson()
                        {
                            $operation = Ajde::app()->getRequest()->getParam('operation');
                            $crudId = Ajde::app()->getRequest()->getParam('crudId');
                            $id = Ajde::app()->getRequest()->getPostParam('id', false);
                    Severity: Minor
                    Found in core/modules/_core/_coreCrudController.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 submission has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                    Open

                        private function submission($crudId, $id)
                        {
                            $session = new Ajde_Session('AC.Crud');
                    
                            /* @var $crud Ajde_Crud */
                    Severity: Minor
                    Found in core/modules/_core/_coreCrudController.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 deleteMultiple has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        private function deleteMultiple($crudId, $id, $parentId = null, $fieldName = null, $all = false)
                    Severity: Minor
                    Found in core/modules/_core/_coreCrudController.php - About 35 mins to fix

                      Avoid too many return statements within this method.
                      Open

                                      return $this->purgeRevisions($crudId);
                      Severity: Major
                      Found in core/modules/_core/_coreCrudController.php - About 30 mins to fix

                        Avoid too many return statements within this method.
                        Open

                                        return $this->deleteMultiple($crudId, $id);
                        Severity: Major
                        Found in core/modules/_core/_coreCrudController.php - About 30 mins to fix

                          Avoid too many return statements within this method.
                          Open

                                          return $this->addMultiple($crudId, $id);
                          Severity: Major
                          Found in core/modules/_core/_coreCrudController.php - About 30 mins to fix

                            Avoid too many return statements within this method.
                            Open

                                            return ['operation' => $operation, 'success' => false];
                            Severity: Major
                            Found in core/modules/_core/_coreCrudController.php - About 30 mins to fix

                              Avoid too many return statements within this method.
                              Open

                                              return $this->getMultipleRow($crudId);
                              Severity: Major
                              Found in core/modules/_core/_coreCrudController.php - About 30 mins to fix

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

                                    public function listHtml()
                                    {
                                        if (Ajde::app()->getRequest()->has('edit') || Ajde::app()->getRequest()->has('new')) {
                                            return $this->editDefault();
                                        }
                                Severity: Minor
                                Found in core/modules/_core/_coreCrudController.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 addMultiple() has an NPath complexity of 6928. The configured NPath complexity threshold is 200.
                                Open

                                    private function addMultiple($crudId, $id, $parentId = null, $fieldName = null)
                                    {
                                        /* @var $crud Ajde_Crud */
                                        if ($crudId instanceof Ajde_Crud) {
                                            $crud = $crudId;

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

                                    private function save($crudId, $id)
                                    {
                                        $session = new Ajde_Session('AC.Crud');
                                
                                        /* @var $crud Ajde_Crud */

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

                                    public function editDefault()
                                    {
                                        $this->setAction('edit');
                                
                                        $crud = $this->getCrudInstance();

                                The method editDefault() has an NPath complexity of 4320. The configured NPath complexity threshold is 200.
                                Open

                                    public function editDefault()
                                    {
                                        $this->setAction('edit');
                                
                                        $crud = $this->getCrudInstance();

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

                                    private function submission($crudId, $id)
                                    {
                                        $session = new Ajde_Session('AC.Crud');
                                
                                        /* @var $crud Ajde_Crud */

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

                                    private function sort($crudId, $id)
                                    {
                                        $session = new Ajde_Session('AC.Crud');
                                        /* @var $crud Ajde_Crud */
                                        $crud = $session->getModel($crudId);

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

                                    public function editDefault()
                                    {
                                        $this->setAction('edit');
                                
                                        $crud = $this->getCrudInstance();

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

                                    private function deleteMultiple($crudId, $id, $parentId = null, $fieldName = null, $all = false)
                                    {
                                        /* @var $crud Ajde_Crud */
                                        if ($crudId instanceof Ajde_Crud) {
                                            $crud = $crudId;

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

                                    private function save($crudId, $id)
                                    {
                                        $session = new Ajde_Session('AC.Crud');
                                
                                        /* @var $crud Ajde_Crud */

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

                                    private function sort($crudId, $id)
                                    {
                                        $session = new Ajde_Session('AC.Crud');
                                        /* @var $crud Ajde_Crud */
                                        $crud = $session->getModel($crudId);

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

                                    private function getMultipleRow($crudId)
                                    {
                                        $session = new Ajde_Session('AC.Crud');
                                        /* @var $crud Ajde_Crud */
                                        $crud = $session->getModel($crudId);

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

                                    public function commitJson()
                                    {
                                        $operation = Ajde::app()->getRequest()->getParam('operation');
                                        $crudId = Ajde::app()->getRequest()->getParam('crudId');
                                        $id = Ajde::app()->getRequest()->getPostParam('id', false);

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

                                    private function submission($crudId, $id)
                                    {
                                        $session = new Ajde_Session('AC.Crud');
                                
                                        /* @var $crud Ajde_Crud */

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

                                    private function addMultiple($crudId, $id, $parentId = null, $fieldName = null)
                                    {
                                        /* @var $crud Ajde_Crud */
                                        if ($crudId instanceof Ajde_Crud) {
                                            $crud = $crudId;

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

                                class _coreCrudController extends Ajde_Acl_Controller
                                {
                                    /************************
                                     * Ajde_Component_Crud
                                     ************************/

                                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

                                Missing class import via use statement (line '21', column '28').
                                Open

                                            $session = new Ajde_Session('AC.Crud');

                                MissingImport

                                Since: 2.7.0

                                Importing all external classes in a file through use statements makes them clearly visible.

                                Example

                                function make() {
                                    return new \stdClass();
                                }

                                Source http://phpmd.org/rules/cleancode.html#MissingImport

                                The method deleteMultiple has a boolean flag argument $all, which is a certain sign of a Single Responsibility Principle violation.
                                Open

                                    private function deleteMultiple($crudId, $id, $parentId = null, $fieldName = null, $all = false)

                                BooleanArgumentFlag

                                Since: 1.4.0

                                A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

                                Example

                                class Foo {
                                    public function bar($flag = true) {
                                    }
                                }

                                Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

                                Missing class import via use statement (line '754', column '38').
                                Open

                                                        $image = new Ajde_Resource_Image($extraField['saveDir'].$value);

                                MissingImport

                                Since: 2.7.0

                                Importing all external classes in a file through use statements makes them clearly visible.

                                Example

                                function make() {
                                    return new \stdClass();
                                }

                                Source http://phpmd.org/rules/cleancode.html#MissingImport

                                Missing class import via use statement (line '48', column '24').
                                Open

                                        $session = new Ajde_Session('AC.Crud');

                                MissingImport

                                Since: 2.7.0

                                Importing all external classes in a file through use statements makes them clearly visible.

                                Example

                                function make() {
                                    return new \stdClass();
                                }

                                Source http://phpmd.org/rules/cleancode.html#MissingImport

                                Missing class import via use statement (line '524', column '27').
                                Open

                                            $mailer = new Ajde_Mailer();

                                MissingImport

                                Since: 2.7.0

                                Importing all external classes in a file through use statements makes them clearly visible.

                                Example

                                function make() {
                                    return new \stdClass();
                                }

                                Source http://phpmd.org/rules/cleancode.html#MissingImport

                                Missing class import via use statement (line '723', column '24').
                                Open

                                        $session = new Ajde_Session('AC.Crud');

                                MissingImport

                                Since: 2.7.0

                                Importing all external classes in a file through use statements makes them clearly visible.

                                Example

                                function make() {
                                    return new \stdClass();
                                }

                                Source http://phpmd.org/rules/cleancode.html#MissingImport

                                Missing class import via use statement (line '787', column '24').
                                Open

                                        $session = new Ajde_Session('AC.Crud');

                                MissingImport

                                Since: 2.7.0

                                Importing all external classes in a file through use statements makes them clearly visible.

                                Example

                                function make() {
                                    return new \stdClass();
                                }

                                Source http://phpmd.org/rules/cleancode.html#MissingImport

                                Missing class import via use statement (line '507', column '27').
                                Open

                                        $submission = new SubmissionModel();

                                MissingImport

                                Since: 2.7.0

                                Importing all external classes in a file through use statements makes them clearly visible.

                                Example

                                function make() {
                                    return new \stdClass();
                                }

                                Source http://phpmd.org/rules/cleancode.html#MissingImport

                                Missing class import via use statement (line '59', column '34').
                                Open

                                            $exportSession = new Ajde_Session('export');

                                MissingImport

                                Since: 2.7.0

                                Importing all external classes in a file through use statements makes them clearly visible.

                                Example

                                function make() {
                                    return new \stdClass();
                                }

                                Source http://phpmd.org/rules/cleancode.html#MissingImport

                                Missing class import via use statement (line '381', column '24').
                                Open

                                        $session = new Ajde_Session('AC.Crud');

                                MissingImport

                                Since: 2.7.0

                                Importing all external classes in a file through use statements makes them clearly visible.

                                Example

                                function make() {
                                    return new \stdClass();
                                }

                                Source http://phpmd.org/rules/cleancode.html#MissingImport

                                Missing class import via use statement (line '177', column '24').
                                Open

                                        $session = new Ajde_Session('AC.Crud');

                                MissingImport

                                Since: 2.7.0

                                Importing all external classes in a file through use statements makes them clearly visible.

                                Example

                                function make() {
                                    return new \stdClass();
                                }

                                Source http://phpmd.org/rules/cleancode.html#MissingImport

                                Missing class import via use statement (line '459', column '24').
                                Open

                                        $session = new Ajde_Session('AC.Crud');

                                MissingImport

                                Since: 2.7.0

                                Importing all external classes in a file through use statements makes them clearly visible.

                                Example

                                function make() {
                                    return new \stdClass();
                                }

                                Source http://phpmd.org/rules/cleancode.html#MissingImport

                                Missing class import via use statement (line '86', column '30').
                                Open

                                        $exportSession = new Ajde_Session('export');

                                MissingImport

                                Since: 2.7.0

                                Importing all external classes in a file through use statements makes them clearly visible.

                                Example

                                function make() {
                                    return new \stdClass();
                                }

                                Source http://phpmd.org/rules/cleancode.html#MissingImport

                                Missing class import via use statement (line '358', column '44').
                                Open

                                                $model->set('updated', new Ajde_Db_Function('updated'));

                                MissingImport

                                Since: 2.7.0

                                Importing all external classes in a file through use statements makes them clearly visible.

                                Example

                                function make() {
                                    return new \stdClass();
                                }

                                Source http://phpmd.org/rules/cleancode.html#MissingImport

                                Missing class import via use statement (line '247', column '24').
                                Open

                                        $session = new Ajde_Session('AC.Crud');

                                MissingImport

                                Since: 2.7.0

                                Importing all external classes in a file through use statements makes them clearly visible.

                                Example

                                function make() {
                                    return new \stdClass();
                                }

                                Source http://phpmd.org/rules/cleancode.html#MissingImport

                                Missing class import via use statement (line '274', column '24').
                                Open

                                        $session = new Ajde_Session('AC.Crud');

                                MissingImport

                                Since: 2.7.0

                                Importing all external classes in a file through use statements makes them clearly visible.

                                Example

                                function make() {
                                    return new \stdClass();
                                }

                                Source http://phpmd.org/rules/cleancode.html#MissingImport

                                Missing class import via use statement (line '628', column '28').
                                Open

                                            $session = new Ajde_Session('AC.Crud');

                                MissingImport

                                Since: 2.7.0

                                Importing all external classes in a file through use statements makes them clearly visible.

                                Example

                                function make() {
                                    return new \stdClass();
                                }

                                Source http://phpmd.org/rules/cleancode.html#MissingImport

                                Missing class import via use statement (line '119', column '40').
                                Open

                                                    $editOptions = new Ajde_Crud_Options_Edit();

                                MissingImport

                                Since: 2.7.0

                                Importing all external classes in a file through use statements makes them clearly visible.

                                Example

                                function make() {
                                    return new \stdClass();
                                }

                                Source http://phpmd.org/rules/cleancode.html#MissingImport

                                Missing class import via use statement (line '39', column '55').
                                Open

                                            Ajde::app()->getDocument()->setLayout(new Ajde_Layout('empty'));

                                MissingImport

                                Since: 2.7.0

                                Importing all external classes in a file through use statements makes them clearly visible.

                                Example

                                function make() {
                                    return new \stdClass();
                                }

                                Source http://phpmd.org/rules/cleancode.html#MissingImport

                                Missing class import via use statement (line '558', column '28').
                                Open

                                            $session = new Ajde_Session('AC.Crud');

                                MissingImport

                                Since: 2.7.0

                                Importing all external classes in a file through use statements makes them clearly visible.

                                Example

                                function make() {
                                    return new \stdClass();
                                }

                                Source http://phpmd.org/rules/cleancode.html#MissingImport

                                Avoid using static access to class 'MetaModel' in method 'submission'.
                                Open

                                                $metaName = MetaModel::getNameFromId($metaId);

                                StaticAccess

                                Since: 1.4.0

                                Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

                                Example

                                class Foo
                                {
                                    public function bar()
                                    {
                                        Bar::baz();
                                    }
                                }

                                Source https://phpmd.org/rules/cleancode.html#staticaccess

                                The method addMultiple uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                                Open

                                        } else {
                                            $session = new Ajde_Session('AC.Crud');
                                            $crud = $session->getModel($crudId);
                                        }

                                ElseExpression

                                Since: 1.4.0

                                An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                                Example

                                class Foo
                                {
                                    public function bar($flag)
                                    {
                                        if ($flag) {
                                            // one branch
                                        } else {
                                            // another branch
                                        }
                                    }
                                }

                                Source https://phpmd.org/rules/cleancode.html#elseexpression

                                The method editDefault uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                                Open

                                            } else {
                                                if ($crud->getOption('edit.layout')) {
                                                    $crud->setAction('edit/layout');
                                                } else {
                                                    // Automatically switch to layouts now

                                ElseExpression

                                Since: 1.4.0

                                An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                                Example

                                class Foo
                                {
                                    public function bar($flag)
                                    {
                                        if ($flag) {
                                            // one branch
                                        } else {
                                            // another branch
                                        }
                                    }
                                }

                                Source https://phpmd.org/rules/cleancode.html#elseexpression

                                The method sort uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                                Open

                                            } else {
                                                $sortValue = $result['min'];
                                            }

                                ElseExpression

                                Since: 1.4.0

                                An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                                Example

                                class Foo
                                {
                                    public function bar($flag)
                                    {
                                        if ($flag) {
                                            // one branch
                                        } else {
                                            // another branch
                                        }
                                    }
                                }

                                Source https://phpmd.org/rules/cleancode.html#elseexpression

                                Avoid using static access to class 'Ajde_Event' in method 'submission'.
                                Open

                                        Ajde_Event::trigger($model, 'beforeCrudSave', [$crud]);

                                StaticAccess

                                Since: 1.4.0

                                Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

                                Example

                                class Foo
                                {
                                    public function bar()
                                    {
                                        Bar::baz();
                                    }
                                }

                                Source https://phpmd.org/rules/cleancode.html#staticaccess

                                The method deleteMultiple uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                                Open

                                        } else {
                                            $childClass = ucfirst($modelName).'Model';
                                            $child = new $childClass();
                                            /* @var $child Ajde_Model */
                                            $child->loadByPK($id);

                                ElseExpression

                                Since: 1.4.0

                                An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                                Example

                                class Foo
                                {
                                    public function bar($flag)
                                    {
                                        if ($flag) {
                                            // one branch
                                        } else {
                                            // another branch
                                        }
                                    }
                                }

                                Source https://phpmd.org/rules/cleancode.html#elseexpression

                                Avoid assigning values to variables in if clauses and the like (line '259', column '17').
                                Open

                                    private function delete($crudId, $id)
                                    {
                                        $session = new Ajde_Session('AC.Crud');
                                        $crud = $session->getModel($crudId);
                                        $model = $crud->getModel();

                                IfStatementAssignment

                                Since: 2.7.0

                                Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.

                                Example

                                class Foo
                                {
                                    public function bar($flag)
                                    {
                                        if ($foo = 'bar') { // possible typo
                                            // ...
                                        }
                                        if ($baz = 0) { // always false
                                            // ...
                                        }
                                    }
                                }

                                Source http://phpmd.org/rules/cleancode.html#ifstatementassignment

                                Avoid using static access to class 'Ajde_Http_Request' in method 'save'.
                                Open

                                        $post = Ajde_Http_Request::globalPost();

                                StaticAccess

                                Since: 1.4.0

                                Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

                                Example

                                class Foo
                                {
                                    public function bar()
                                    {
                                        Bar::baz();
                                    }
                                }

                                Source https://phpmd.org/rules/cleancode.html#staticaccess

                                Avoid using static access to class 'Ajde_Event' in method 'save'.
                                Open

                                        Ajde_Event::trigger($model, 'beforeCrudSave', [$crud]);

                                StaticAccess

                                Since: 1.4.0

                                Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

                                Example

                                class Foo
                                {
                                    public function bar()
                                    {
                                        Bar::baz();
                                    }
                                }

                                Source https://phpmd.org/rules/cleancode.html#staticaccess

                                Avoid assigning values to variables in if clauses and the like (line '749', column '25').
                                Open

                                    private function getMultipleRow($crudId)
                                    {
                                        $session = new Ajde_Session('AC.Crud');
                                        /* @var $crud Ajde_Crud */
                                        $crud = $session->getModel($crudId);

                                IfStatementAssignment

                                Since: 2.7.0

                                Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.

                                Example

                                class Foo
                                {
                                    public function bar($flag)
                                    {
                                        if ($foo = 'bar') { // possible typo
                                            // ...
                                        }
                                        if ($baz = 0) { // always false
                                            // ...
                                        }
                                    }
                                }

                                Source http://phpmd.org/rules/cleancode.html#ifstatementassignment

                                Avoid using static access to class 'Ajde_Event' in method 'save'.
                                Open

                                        Ajde_Event::trigger($model, 'afterCrudSave', [$crud]);

                                StaticAccess

                                Since: 1.4.0

                                Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

                                Example

                                class Foo
                                {
                                    public function bar()
                                    {
                                        Bar::baz();
                                    }
                                }

                                Source https://phpmd.org/rules/cleancode.html#staticaccess

                                Avoid using static access to class 'Ajde_Http_Request' in method 'submission'.
                                Open

                                        $post = Ajde_Http_Request::globalPost();

                                StaticAccess

                                Since: 1.4.0

                                Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

                                Example

                                class Foo
                                {
                                    public function bar()
                                    {
                                        Bar::baz();
                                    }
                                }

                                Source https://phpmd.org/rules/cleancode.html#staticaccess

                                The method addMultiple uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                                Open

                                        } else {
                                            // Not possible
                                        }

                                ElseExpression

                                Since: 1.4.0

                                An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                                Example

                                class Foo
                                {
                                    public function bar($flag)
                                    {
                                        if ($flag) {
                                            // one branch
                                        } else {
                                            // another branch
                                        }
                                    }
                                }

                                Source https://phpmd.org/rules/cleancode.html#elseexpression

                                Avoid using static access to class 'Ajde_User' in method 'submission'.
                                Open

                                        $submission->user = Ajde_User::getLoggedIn();

                                StaticAccess

                                Since: 1.4.0

                                Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

                                Example

                                class Foo
                                {
                                    public function bar()
                                    {
                                        Bar::baz();
                                    }
                                }

                                Source https://phpmd.org/rules/cleancode.html#staticaccess

                                Avoid using static access to class 'Ajde_Session_Flash' in method 'save'.
                                Open

                                                    Ajde_Session_Flash::alert('Record '.($operation == 'insert' ? 'added' : 'saved').': '.$model->get($model->getDisplayField()));

                                StaticAccess

                                Since: 1.4.0

                                Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

                                Example

                                class Foo
                                {
                                    public function bar()
                                    {
                                        Bar::baz();
                                    }
                                }

                                Source https://phpmd.org/rules/cleancode.html#staticaccess

                                The method editDefault uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                                Open

                                                } else {
                                                    // Automatically switch to layouts now
                                                    //                    $crud->setAction('edit');
                                
                                                    // Insert layout and set action

                                ElseExpression

                                Since: 1.4.0

                                An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                                Example

                                class Foo
                                {
                                    public function bar($flag)
                                    {
                                        if ($flag) {
                                            // one branch
                                        } else {
                                            // another branch
                                        }
                                    }
                                }

                                Source https://phpmd.org/rules/cleancode.html#elseexpression

                                The method deleteMultiple uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                                Open

                                        } else {
                                            $session = new Ajde_Session('AC.Crud');
                                            $crud = $session->getModel($crudId);
                                        }

                                ElseExpression

                                Since: 1.4.0

                                An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                                Example

                                class Foo
                                {
                                    public function bar($flag)
                                    {
                                        if ($flag) {
                                            // one branch
                                        } else {
                                            // another branch
                                        }
                                    }
                                }

                                Source https://phpmd.org/rules/cleancode.html#elseexpression

                                The method deleteMultiple uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                                Open

                                            } else {
                                                $childField = isset($fieldProperties['childField']) ? $fieldProperties['childField'] : $modelName;
                                                $parentField = (string) $model->getTable();
                                                $sql = 'DELETE FROM '.$fieldProperties['crossReferenceTable'].' WHERE '.$parentField.' = ? AND '.$childField.' = ?';
                                                $values = [$parentId, $id];

                                ElseExpression

                                Since: 1.4.0

                                An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                                Example

                                class Foo
                                {
                                    public function bar($flag)
                                    {
                                        if ($flag) {
                                            // one branch
                                        } else {
                                            // another branch
                                        }
                                    }
                                }

                                Source https://phpmd.org/rules/cleancode.html#elseexpression

                                The method sort uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                                Open

                                            } else {
                                                $sortValue = $result['min'];
                                            }

                                ElseExpression

                                Since: 1.4.0

                                An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                                Example

                                class Foo
                                {
                                    public function bar($flag)
                                    {
                                        if ($flag) {
                                            // one branch
                                        } else {
                                            // another branch
                                        }
                                    }
                                }

                                Source https://phpmd.org/rules/cleancode.html#elseexpression

                                The method addMultiple uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                                Open

                                                        } else {
                                                            $sortValue = $result['max'] + 1;
                                                        }

                                ElseExpression

                                Since: 1.4.0

                                An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                                Example

                                class Foo
                                {
                                    public function bar($flag)
                                    {
                                        if ($flag) {
                                            // one branch
                                        } else {
                                            // another branch
                                        }
                                    }
                                }

                                Source https://phpmd.org/rules/cleancode.html#elseexpression

                                The method getMultipleRow uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                                Open

                                                } else {
                                                    if ($type == 'text') {
                                                        $html = $value;
                                                    }
                                                }

                                ElseExpression

                                Since: 1.4.0

                                An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                                Example

                                class Foo
                                {
                                    public function bar($flag)
                                    {
                                        if ($flag) {
                                            // one branch
                                        } else {
                                            // another branch
                                        }
                                    }
                                }

                                Source https://phpmd.org/rules/cleancode.html#elseexpression

                                Avoid using static access to class 'Ajde_Component_String' in method 'delete'.
                                Open

                                            'message'   => Ajde_Component_String::makePlural($deleted, 'record').' deleted',

                                StaticAccess

                                Since: 1.4.0

                                Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

                                Example

                                class Foo
                                {
                                    public function bar()
                                    {
                                        Bar::baz();
                                    }
                                }

                                Source https://phpmd.org/rules/cleancode.html#staticaccess

                                The method sort uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                                Open

                                        } else {
                                            // Get and validate sort field
                                            $sortField = Ajde::app()->getRequest()->getPostParam('field');
                                            $sortTable = (string) $model->getTable();
                                            $field = $crud->getField($sortField); // throws exception when not found

                                ElseExpression

                                Since: 1.4.0

                                An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                                Example

                                class Foo
                                {
                                    public function bar($flag)
                                    {
                                        if ($flag) {
                                            // one branch
                                        } else {
                                            // another branch
                                        }
                                    }
                                }

                                Source https://phpmd.org/rules/cleancode.html#elseexpression

                                Avoid using static access to class 'Ajde_Session_Flash' in method 'submission'.
                                Open

                                            Ajde_Session_Flash::alert(trans('Form submitted successfully'));

                                StaticAccess

                                Since: 1.4.0

                                Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

                                Example

                                class Foo
                                {
                                    public function bar()
                                    {
                                        Bar::baz();
                                    }
                                }

                                Source https://phpmd.org/rules/cleancode.html#staticaccess

                                Avoid using static access to class 'Ajde_Resource_FileIcon' in method 'getMultipleRow'.
                                Open

                                                        $html = "<img class='icon' src='".Ajde_Resource_FileIcon::_($extension)."' />";

                                StaticAccess

                                Since: 1.4.0

                                Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

                                Example

                                class Foo
                                {
                                    public function bar()
                                    {
                                        Bar::baz();
                                    }
                                }

                                Source https://phpmd.org/rules/cleancode.html#staticaccess

                                The method getMultipleRow uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                                Open

                                                    } else {
                                                        $html = "<img class='icon' src='".Ajde_Resource_FileIcon::_($extension)."' />";
                                                        $html = $html." <a class='filePreview preview' href='".$extraField['saveDir'].$value."' target='_blank'>".$value.'</a>';
                                                    }

                                ElseExpression

                                Since: 1.4.0

                                An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                                Example

                                class Foo
                                {
                                    public function bar($flag)
                                    {
                                        if ($flag) {
                                            // one branch
                                        } else {
                                            // another branch
                                        }
                                    }
                                }

                                Source https://phpmd.org/rules/cleancode.html#elseexpression

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

                                        $model = $crud->getModel();

                                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 '$value'.
                                Open

                                        foreach ($post as $key => $value) {

                                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 '$allowed'.
                                Open

                                    public function beforeInvoke($allowed = [])

                                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

                                The method exportBuffer() contains an exit expression.
                                Open

                                        exit;

                                ExitExpression

                                Since: 0.2

                                An exit-expression within regular code is untestable and therefore it should be avoided. Consider to move the exit-expression into some kind of startup script where an error/exception code is returned to the calling environment.

                                Example

                                class Foo {
                                    public function bar($param)  {
                                        if ($param === 42) {
                                            exit(23);
                                        }
                                    }
                                }

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

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

                                                    if ($isImage = in_array(strtolower($extension), ['jpg', 'jpeg', 'png', 'gif'])) {

                                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: implement parent recursive sorting

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

                                    private function sort($crudId, $id)

                                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 class _coreCrudController is not named in CamelCase.
                                Open

                                class _coreCrudController extends Ajde_Acl_Controller
                                {
                                    /************************
                                     * Ajde_Component_Crud
                                     ************************/

                                CamelCaseClassName

                                Since: 0.2

                                It is considered best practice to use the CamelCase notation to name classes.

                                Example

                                class class_name {
                                }

                                Source

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

                                        $id = Ajde::app()->getRequest()->getPostParam('id', false);

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

                                        $id = Ajde::app()->getRequest()->getParam('id');

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

                                    private function submission($crudId, $id)

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

                                    private function addMultiple($crudId, $id, $parentId = null, $fieldName = null)

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

                                    private function save($crudId, $id)

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

                                    private function delete($crudId, $id)

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

                                    private function deleteMultiple($crudId, $id, $parentId = null, $fieldName = null, $all = false)

                                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 variable $email_address is not named in camelCase.
                                Open

                                    private function submission($crudId, $id)
                                    {
                                        $session = new Ajde_Session('AC.Crud');
                                
                                        /* @var $crud Ajde_Crud */

                                CamelCaseVariableName

                                Since: 0.2

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

                                Example

                                class ClassName {
                                    public function doSomething() {
                                        $data_module = new DataModule();
                                    }
                                }

                                Source

                                The variable $email_to is not named in camelCase.
                                Open

                                    private function submission($crudId, $id)
                                    {
                                        $session = new Ajde_Session('AC.Crud');
                                
                                        /* @var $crud Ajde_Crud */

                                CamelCaseVariableName

                                Since: 0.2

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

                                Example

                                class ClassName {
                                    public function doSomething() {
                                        $data_module = new DataModule();
                                    }
                                }

                                Source

                                The variable $email_address is not named in camelCase.
                                Open

                                    private function submission($crudId, $id)
                                    {
                                        $session = new Ajde_Session('AC.Crud');
                                
                                        /* @var $crud Ajde_Crud */

                                CamelCaseVariableName

                                Since: 0.2

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

                                Example

                                class ClassName {
                                    public function doSomething() {
                                        $data_module = new DataModule();
                                    }
                                }

                                Source

                                The variable $email_address is not named in camelCase.
                                Open

                                    private function submission($crudId, $id)
                                    {
                                        $session = new Ajde_Session('AC.Crud');
                                
                                        /* @var $crud Ajde_Crud */

                                CamelCaseVariableName

                                Since: 0.2

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

                                Example

                                class ClassName {
                                    public function doSomething() {
                                        $data_module = new DataModule();
                                    }
                                }

                                Source

                                The variable $email_to is not named in camelCase.
                                Open

                                    private function submission($crudId, $id)
                                    {
                                        $session = new Ajde_Session('AC.Crud');
                                
                                        /* @var $crud Ajde_Crud */

                                CamelCaseVariableName

                                Since: 0.2

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

                                Example

                                class ClassName {
                                    public function doSomething() {
                                        $data_module = new DataModule();
                                    }
                                }

                                Source

                                The variable $email_to is not named in camelCase.
                                Open

                                    private function submission($crudId, $id)
                                    {
                                        $session = new Ajde_Session('AC.Crud');
                                
                                        /* @var $crud Ajde_Crud */

                                CamelCaseVariableName

                                Since: 0.2

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

                                Example

                                class ClassName {
                                    public function doSomething() {
                                        $data_module = new DataModule();
                                    }
                                }

                                Source

                                The variable $email_address is not named in camelCase.
                                Open

                                    private function submission($crudId, $id)
                                    {
                                        $session = new Ajde_Session('AC.Crud');
                                
                                        /* @var $crud Ajde_Crud */

                                CamelCaseVariableName

                                Since: 0.2

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

                                Example

                                class ClassName {
                                    public function doSomething() {
                                        $data_module = new DataModule();
                                    }
                                }

                                Source

                                There are no issues that match your filters.

                                Category
                                Status