mambax7/extgallery

View on GitHub
class/CategoryHandler.php

Summary

Maintainability
D
2 days
Test Coverage

getCatRestrictCriteria accesses the super-global variable $GLOBALS.
Open

    public function getCatRestrictCriteria($permType = 'public_access')
    {
        if (null !== $GLOBALS['xoopsUser'] && \is_object($GLOBALS['xoopsUser'])) {
            $permHandler       = $this->getPermHandler();
            $allowedCategories = $permHandler->getAuthorizedPublicCat($GLOBALS['xoopsUser'], $permType);
Severity: Minor
Found in class/CategoryHandler.php by phpmd

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

makeSelect accesses the super-global variable $_SERVER.
Open

    public function makeSelect($cats, $name, $selectMode, $addEmpty, $selected, $extra, $displayWeight)
    {
        $ret = '<select name="' . $name . '" id="' . $name . '"' . $extra . '>';
        if ($addEmpty) {
            $ret .= '<option value="0">-----</option>';
Severity: Minor
Found in class/CategoryHandler.php by phpmd

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

getCatRestrictCriteria accesses the super-global variable $GLOBALS.
Open

    public function getCatRestrictCriteria($permType = 'public_access')
    {
        if (null !== $GLOBALS['xoopsUser'] && \is_object($GLOBALS['xoopsUser'])) {
            $permHandler       = $this->getPermHandler();
            $allowedCategories = $permHandler->getAuthorizedPublicCat($GLOBALS['xoopsUser'], $permType);
Severity: Minor
Found in class/CategoryHandler.php by phpmd

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

getCatRestrictCriteria accesses the super-global variable $GLOBALS.
Open

    public function getCatRestrictCriteria($permType = 'public_access')
    {
        if (null !== $GLOBALS['xoopsUser'] && \is_object($GLOBALS['xoopsUser'])) {
            $permHandler       = $this->getPermHandler();
            $allowedCategories = $permHandler->getAuthorizedPublicCat($GLOBALS['xoopsUser'], $permType);
Severity: Minor
Found in class/CategoryHandler.php by phpmd

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 CategoryHandler.php has 329 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace XoopsModules\Extgallery;

/**
Severity: Minor
Found in class/CategoryHandler.php - About 3 hrs to fix

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

    class CategoryHandler extends Extgallery\PersistableObjectHandler
    {
        //var $_nestedTree;
        public $_photoHandler;
    
    
    Severity: Minor
    Found in class/CategoryHandler.php by phpmd

    CategoryHandler has 23 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class CategoryHandler extends Extgallery\PersistableObjectHandler
    {
        //var $_nestedTree;
        public $_photoHandler;
    
    
    Severity: Minor
    Found in class/CategoryHandler.php - About 2 hrs to fix

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

          public function makeSelect($cats, $name, $selectMode, $addEmpty, $selected, $extra, $displayWeight)
          {
              $ret = '<select name="' . $name . '" id="' . $name . '"' . $extra . '>';
              if ($addEmpty) {
                  $ret .= '<option value="0">-----</option>';
      Severity: Minor
      Found in class/CategoryHandler.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 getDescendants has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

          public function getDescendants(
              $id = 0,
              $includeSelf = false,
              $childrenOnly = false,
              $withRestrict = true,
      Severity: Minor
      Found in class/CategoryHandler.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 rebuild has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          public function rebuild()
          {
              $data = $this->getTreeWithChildren();
      
              $n     = 0; // need a variable to hold the running n tally
      Severity: Minor
      Found in class/CategoryHandler.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 getDescendants has 34 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function getDescendants(
              $id = 0,
              $includeSelf = false,
              $childrenOnly = false,
              $withRestrict = true,
      Severity: Minor
      Found in class/CategoryHandler.php - About 1 hr to fix

        Method rebuild has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function rebuild()
            {
                $data = $this->getTreeWithChildren();
        
                $n     = 0; // need a variable to hold the running n tally
        Severity: Minor
        Found in class/CategoryHandler.php - About 1 hr to fix

          Method makeSelect has 30 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function makeSelect($cats, $name, $selectMode, $addEmpty, $selected, $extra, $displayWeight)
              {
                  $ret = '<select name="' . $name . '" id="' . $name . '"' . $extra . '>';
                  if ($addEmpty) {
                      $ret .= '<option value="0">-----</option>';
          Severity: Minor
          Found in class/CategoryHandler.php - About 1 hr to fix

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

                public function getBlockSelect($selected = [])
                {
                    $cats           = $this->getDescendants();
                    $ret            = '<select name="options[]" multiple="multiple">';
                    $selectedOption = '';
            Severity: Minor
            Found in class/CategoryHandler.php - About 55 mins to fix

            Cognitive Complexity

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

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

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

            Further reading

            Method makeSelect has 7 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                public function makeSelect($cats, $name, $selectMode, $addEmpty, $selected, $extra, $displayWeight)
            Severity: Major
            Found in class/CategoryHandler.php - About 50 mins to fix

              Method getSelect has 7 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                      $name,
                      $selectMode,
                      $addEmpty = false,
                      $selected = 0,
                      $extra = '',
              Severity: Major
              Found in class/CategoryHandler.php - About 50 mins to fix

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

                    public function getCatRestrictCriteria($permType = 'public_access')
                    {
                        if (null !== $GLOBALS['xoopsUser'] && \is_object($GLOBALS['xoopsUser'])) {
                            $permHandler       = $this->getPermHandler();
                            $allowedCategories = $permHandler->getAuthorizedPublicCat($GLOBALS['xoopsUser'], $permType);
                Severity: Minor
                Found in class/CategoryHandler.php - About 45 mins to fix

                Cognitive Complexity

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

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

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

                Further reading

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

                        $id = 0,
                        $includeSelf = false,
                        $childrenOnly = false,
                        $withRestrict = true,
                        $permType = 'public_access'
                Severity: Minor
                Found in class/CategoryHandler.php - About 35 mins to fix

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

                      public function getLeafSelect($name, $addEmpty = false, $selected = 0, $extra = '', $permType = 'public_access')
                  Severity: Minor
                  Found in class/CategoryHandler.php - About 35 mins to fix

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

                        public function makeSelect($cats, $name, $selectMode, $addEmpty, $selected, $extra, $displayWeight)
                        {
                            $ret = '<select name="' . $name . '" id="' . $name . '"' . $extra . '>';
                            if ($addEmpty) {
                                $ret .= '<option value="0">-----</option>';
                    Severity: Minor
                    Found in class/CategoryHandler.php by phpmd

                    CyclomaticComplexity

                    Since: 0.1

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

                    Example

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

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

                    Missing class import via use statement (line '124', column '32').
                    Open

                                $criteria->add(new \Criteria('cat_pid', $parent_id), 'OR');
                    Severity: Minor
                    Found in class/CategoryHandler.php by phpmd

                    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 '134', column '36').
                    Open

                                    $criteria->add(new \Criteria('nright', $nright, '<='));
                    Severity: Minor
                    Found in class/CategoryHandler.php by phpmd

                    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 '173', column '28').
                    Open

                            $criteria->add(new \Criteria('cat_id', $id));
                    Severity: Minor
                    Found in class/CategoryHandler.php by phpmd

                    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 '224', column '25').
                    Open

                            $criteria = new \CriteriaCompo();
                    Severity: Minor
                    Found in class/CategoryHandler.php by phpmd

                    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 '167', column '25').
                    Open

                            $criteria = new \CriteriaCompo();
                    Severity: Minor
                    Found in class/CategoryHandler.php by phpmd

                    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 '133', column '36').
                    Open

                                    $criteria->add(new \Criteria('nleft', $nleft, '>='));
                    Severity: Minor
                    Found in class/CategoryHandler.php by phpmd

                    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 getDescendants has a boolean flag argument $withRestrict, which is a certain sign of a Single Responsibility Principle violation.
                    Open

                            $withRestrict = true,
                    Severity: Minor
                    Found in class/CategoryHandler.php by phpmd

                    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 '121', column '25').
                    Open

                            $criteria = new \CriteriaCompo();
                    Severity: Minor
                    Found in class/CategoryHandler.php by phpmd

                    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 getPath has a boolean flag argument $includeSelf, which is a certain sign of a Single Responsibility Principle violation.
                    Open

                        public function getPath($id = 0, $includeSelf = false)
                    Severity: Minor
                    Found in class/CategoryHandler.php by phpmd

                    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 '231', column '32').
                    Open

                                $criteria->add(new \Criteria('nright', $cat->getVar('nright'), '>'));
                    Severity: Minor
                    Found in class/CategoryHandler.php by phpmd

                    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 '126', column '36').
                    Open

                                    $criteria->add(new \Criteria('cat_id', $parent_id));
                    Severity: Minor
                    Found in class/CategoryHandler.php by phpmd

                    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 '139', column '40').
                    Open

                                        $criteria->add(new \Criteria('nright', $nright, '<'));
                    Severity: Minor
                    Found in class/CategoryHandler.php by phpmd

                    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 getChildren has a boolean flag argument $includeSelf, which is a certain sign of a Single Responsibility Principle violation.
                    Open

                        public function getChildren($id = 0, $includeSelf = false)
                    Severity: Minor
                    Found in class/CategoryHandler.php by phpmd

                    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 '138', column '40').
                    Open

                                        $criteria->add(new \Criteria('nleft', $nleft, '>'));
                    Severity: Minor
                    Found in class/CategoryHandler.php by phpmd

                    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 '226', column '32').
                    Open

                                $criteria->add(new \Criteria('nleft', $cat->getVar('nleft'), '<='));
                    Severity: Minor
                    Found in class/CategoryHandler.php by phpmd

                    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 '501', column '36').
                    Open

                                    $criteria->add(new \Criteria('cat_id', $id));
                    Severity: Minor
                    Found in class/CategoryHandler.php by phpmd

                    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 '578', column '33').
                    Open

                                    $criteria = new \Criteria('cat_id', '(0)', 'IN');
                    Severity: Minor
                    Found in class/CategoryHandler.php by phpmd

                    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 getNodeSelect has a boolean flag argument $addEmpty, which is a certain sign of a Single Responsibility Principle violation.
                    Open

                        public function getNodeSelect($name, $addEmpty = false, $selected = 0, $extra = '')
                    Severity: Minor
                    Found in class/CategoryHandler.php by phpmd

                    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 '500', column '33').
                    Open

                                    $criteria = new \CriteriaCompo();
                    Severity: Minor
                    Found in class/CategoryHandler.php by phpmd

                    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 '277', column '32').
                    Open

                                $criteria->add(new \Criteria('nleft', $cat->getVar('nleft'), '>'));
                    Severity: Minor
                    Found in class/CategoryHandler.php by phpmd

                    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 '502', column '36').
                    Open

                                    $criteria->add(new \Criteria('photo_approved', 1));
                    Severity: Minor
                    Found in class/CategoryHandler.php by phpmd

                    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 getLeafSelect has a boolean flag argument $addEmpty, which is a certain sign of a Single Responsibility Principle violation.
                    Open

                        public function getLeafSelect($name, $addEmpty = false, $selected = 0, $extra = '', $permType = 'public_access')
                    Severity: Minor
                    Found in class/CategoryHandler.php by phpmd

                    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 '432', column '25').
                    Open

                            $criteria = new \CriteriaCompo();
                    Severity: Minor
                    Found in class/CategoryHandler.php by phpmd

                    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 '576', column '33').
                    Open

                                    $criteria = new \Criteria('cat_id', $in, 'IN');
                    Severity: Minor
                    Found in class/CategoryHandler.php by phpmd

                    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 '273', column '25').
                    Open

                            $criteria = new \CriteriaCompo(new \Criteria('nright - nleft', 1));
                    Severity: Minor
                    Found in class/CategoryHandler.php by phpmd

                    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 '278', column '32').
                    Open

                                $criteria->add(new \Criteria('nright', $cat->getVar('nright'), '<'));
                    Severity: Minor
                    Found in class/CategoryHandler.php by phpmd

                    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 '273', column '44').
                    Open

                            $criteria = new \CriteriaCompo(new \Criteria('nright - nleft', 1));
                    Severity: Minor
                    Found in class/CategoryHandler.php by phpmd

                    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 getSelect has a boolean flag argument $displayWeight, which is a certain sign of a Single Responsibility Principle violation.
                    Open

                            $displayWeight = false,
                    Severity: Minor
                    Found in class/CategoryHandler.php by phpmd

                    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

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

                            $includeSelf = false,
                    Severity: Minor
                    Found in class/CategoryHandler.php by phpmd

                    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

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

                            $childrenOnly = false,
                    Severity: Minor
                    Found in class/CategoryHandler.php by phpmd

                    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 '227', column '32').
                    Open

                                $criteria->add(new \Criteria('nright', $cat->getVar('nright'), '>='));
                    Severity: Minor
                    Found in class/CategoryHandler.php by phpmd

                    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 '230', column '32').
                    Open

                                $criteria->add(new \Criteria('nleft', $cat->getVar('nleft'), '<'));
                    Severity: Minor
                    Found in class/CategoryHandler.php by phpmd

                    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 getSelect has a boolean flag argument $addEmpty, which is a certain sign of a Single Responsibility Principle violation.
                    Open

                            $addEmpty = false,
                    Severity: Minor
                    Found in class/CategoryHandler.php by phpmd

                    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

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

                            } else {
                                $criteria->add(new \Criteria('nleft', $cat->getVar('nleft'), '<'));
                                $criteria->add(new \Criteria('nright', $cat->getVar('nright'), '>'));
                                //$query = sprintf('select * from %s where nleft < %d and nright > %d order by nlevel', $this->table, $node['nleft'], $node['nright']);
                            }
                    Severity: Minor
                    Found in class/CategoryHandler.php by phpmd

                    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 getDescendants uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                    Open

                            } else {
                                if ($nleft > 0 && $includeSelf) {
                                    $criteria->add(new \Criteria('nleft', $nleft, '>='));
                                    $criteria->add(new \Criteria('nright', $nright, '<='));
                                    //$query = sprintf('select * from %s where nleft >= %d and nright <= %d order by nleft', $this->table, $nleft, $nright);
                    Severity: Minor
                    Found in class/CategoryHandler.php by phpmd

                    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 getDescendants uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                    Open

                                } else {
                                    if ($nleft > 0) {
                                        $criteria->add(new \Criteria('nleft', $nleft, '>'));
                                        $criteria->add(new \Criteria('nright', $nright, '<'));
                                        //$query = sprintf('select * from %s where nleft > %d and nright < %d order by nleft', $this->table, $nleft, $nright);
                    Severity: Minor
                    Found in class/CategoryHandler.php by phpmd

                    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 getCatRestrictCriteria uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                    Open

                                } else {
                                    $criteria = new \Criteria('cat_id', '(0)', 'IN');
                                }
                    Severity: Minor
                    Found in class/CategoryHandler.php by phpmd

                    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 '\XoopsModules\Extgallery\PublicPermHandler' in method 'getPermHandler'.
                    Open

                            return Extgallery\PublicPermHandler::getInstance();
                    Severity: Minor
                    Found in class/CategoryHandler.php by phpmd

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

                            $level = 0; // need a variable to hold the running level tally
                    Severity: Minor
                    Found in class/CategoryHandler.php by phpmd

                    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

                    The method hasValidParent() contains an exit expression.
                    Open

                            exit('hasValidParent() method must be defined on sub classes');
                    Severity: Minor
                    Found in class/CategoryHandler.php by phpmd

                    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

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

                        public function _generateTreeData(&$arr, $id, $level, &$n)
                        {
                            $arr[$id]['nlevel'] = $level;
                            $arr[$id]['nleft']  = ++$n;
                    
                    
                    Severity: Major
                    Found in class/CategoryHandler.php and 1 other location - About 1 hr to fix
                    class/NestedTree.php on lines 386..397

                    Duplicated Code

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

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

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

                    Tuning

                    This issue has a mass of 105.

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

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

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

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

                    Refactorings

                    Further Reading

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

                        public function __construct(\XoopsDatabase $db, $type)
                    Severity: Minor
                    Found in class/CategoryHandler.php by phpmd

                    ShortVariable

                    Since: 0.2

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

                    Example

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

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

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

                            $id = 0,
                    Severity: Minor
                    Found in class/CategoryHandler.php by phpmd

                    ShortVariable

                    Since: 0.2

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

                    Example

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

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

                    The property $_photoHandler is not named in camelCase.
                    Open

                    class CategoryHandler extends Extgallery\PersistableObjectHandler
                    {
                        //var $_nestedTree;
                        public $_photoHandler;
                    
                    
                    Severity: Minor
                    Found in class/CategoryHandler.php by phpmd

                    CamelCasePropertyName

                    Since: 0.2

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

                    Example

                    class ClassName {
                        protected $property_name;
                    }

                    Source

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

                        public function getChildren($id = 0, $includeSelf = false)
                    Severity: Minor
                    Found in class/CategoryHandler.php by phpmd

                    ShortVariable

                    Since: 0.2

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

                    Example

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

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

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

                        public function getCat($id = 0)
                    Severity: Minor
                    Found in class/CategoryHandler.php by phpmd

                    ShortVariable

                    Since: 0.2

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

                    Example

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

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

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

                        public function getPath($id = 0, $includeSelf = false)
                    Severity: Minor
                    Found in class/CategoryHandler.php by phpmd

                    ShortVariable

                    Since: 0.2

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

                    Example

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

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

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

                        public function nbAlbum($id = 0)
                    Severity: Minor
                    Found in class/CategoryHandler.php by phpmd

                    ShortVariable

                    Since: 0.2

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

                    Example

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

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

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

                                    $in = '(' . $allowedCategories[0];
                    Severity: Minor
                    Found in class/CategoryHandler.php by phpmd

                    ShortVariable

                    Since: 0.2

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

                    Example

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

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

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

                        public function _generateTreeData(&$arr, $id, $level, &$n)
                    Severity: Minor
                    Found in class/CategoryHandler.php by phpmd

                    ShortVariable

                    Since: 0.2

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

                    Example

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

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

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

                            $n     = 0; // need a variable to hold the running n tally
                    Severity: Minor
                    Found in class/CategoryHandler.php by phpmd

                    ShortVariable

                    Since: 0.2

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

                    Example

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

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

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

                        public function _generateTreeData(&$arr, $id, $level, &$n)
                    Severity: Minor
                    Found in class/CategoryHandler.php by phpmd

                    ShortVariable

                    Since: 0.2

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

                    Example

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

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

                    Method name "_generateTreeData" should not be prefixed with an underscore to indicate visibility
                    Open

                        public function _generateTreeData(&$arr, $id, $level, &$n)
                    Severity: Minor
                    Found in class/CategoryHandler.php by phpcodesniffer

                    Property name "$_photoHandler" should not be prefixed with an underscore to indicate visibility
                    Open

                        public $_photoHandler;
                    Severity: Minor
                    Found in class/CategoryHandler.php by phpcodesniffer

                    Method name "_isAlbum" should not be prefixed with an underscore to indicate visibility
                    Open

                        public function _isAlbum($cat)
                    Severity: Minor
                    Found in class/CategoryHandler.php by phpcodesniffer

                    Line exceeds 120 characters; contains 179 characters
                    Open

                                    //$query = sprintf('select * from %s where %s = %d or %s = %d order by nleft', $this->table, $this->fields['id'], $parent_id, $this->fields['parent'], $parent_id);
                    Severity: Minor
                    Found in class/CategoryHandler.php by phpcodesniffer

                    Line exceeds 120 characters; contains 135 characters
                    Open

                                    //$query = sprintf('select * from %s where %s = %d order by nleft', $this->table, $this->fields['parent'], $parent_id);
                    Severity: Minor
                    Found in class/CategoryHandler.php by phpcodesniffer

                    Line exceeds 120 characters; contains 128 characters
                    Open

                                    $sql   = 'UPDATE `%s` SET ' . $upNbAlbum . 'cat_nb_photo = cat_nb_photo + %d WHERE nleft < %d AND nright > %d;';
                    Severity: Minor
                    Found in class/CategoryHandler.php by phpcodesniffer

                    Line exceeds 120 characters; contains 138 characters
                    Open

                                        //$query = sprintf('select * from %s where nleft > %d and nright < %d order by nleft', $this->table, $nleft, $nright);
                    Severity: Minor
                    Found in class/CategoryHandler.php by phpcodesniffer

                    Line exceeds 120 characters; contains 136 characters
                    Open

                                    //$query = sprintf('select * from %s where nleft >= %d and nright <= %d order by nleft', $this->table, $nleft, $nright);
                    Severity: Minor
                    Found in class/CategoryHandler.php by phpcodesniffer

                    Line exceeds 120 characters; contains 149 characters
                    Open

                                //$query = sprintf('select * from %s where nleft <= %d and nright >= %d order by nlevel', $this->table, $node['nleft'], $node['nright']);
                    Severity: Minor
                    Found in class/CategoryHandler.php by phpcodesniffer

                    Line exceeds 120 characters; contains 172 characters
                    Open

                                $ret .= '<option value="' . $cat->getVar('cat_id') . '"' . $selectedOption . '' . $disableOption . '>' . $prefix . ' ' . $cat->getVar('cat_name') . '</option>';
                    Severity: Minor
                    Found in class/CategoryHandler.php by phpcodesniffer

                    Line exceeds 120 characters; contains 184 characters
                    Open

                                $query = \sprintf('UPDATE `%s`SET nlevel = %d, nleft = %d, nright = %d WHERE `%s` = %d;', $this->table, $row['nlevel'], $row['nleft'], $row['nright'], $this->keyName, $id);
                    Severity: Minor
                    Found in class/CategoryHandler.php by phpcodesniffer

                    Line exceeds 120 characters; contains 147 characters
                    Open

                                //$query = sprintf('select * from %s where nleft < %d and nright > %d order by nlevel', $this->table, $node['nleft'], $node['nright']);
                    Severity: Minor
                    Found in class/CategoryHandler.php by phpcodesniffer

                    Line exceeds 120 characters; contains 140 characters
                    Open

                                $ret .= '<option value="' . $cat->getVar('cat_id') . '"' . $selectedOption . '' . $disableOption . '>' . $catName . '</option>';
                    Severity: Minor
                    Found in class/CategoryHandler.php by phpcodesniffer

                    The variable $parent_id is not named in camelCase.
                    Open

                        public function getDescendants(
                            $id = 0,
                            $includeSelf = false,
                            $childrenOnly = false,
                            $withRestrict = true,
                    Severity: Minor
                    Found in class/CategoryHandler.php by phpmd

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

                        public function getDescendants(
                            $id = 0,
                            $includeSelf = false,
                            $childrenOnly = false,
                            $withRestrict = true,
                    Severity: Minor
                    Found in class/CategoryHandler.php by phpmd

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

                        public function _generateTreeData(&$arr, $id, $level, &$n)
                        {
                            $arr[$id]['nlevel'] = $level;
                            $arr[$id]['nleft']  = ++$n;
                    
                    
                    Severity: Minor
                    Found in class/CategoryHandler.php by phpmd

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

                        public function _generateTreeData(&$arr, $id, $level, &$n)
                        {
                            $arr[$id]['nlevel'] = $level;
                            $arr[$id]['nleft']  = ++$n;
                    
                    
                    Severity: Minor
                    Found in class/CategoryHandler.php by phpmd

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

                        public function getDescendants(
                            $id = 0,
                            $includeSelf = false,
                            $childrenOnly = false,
                            $withRestrict = true,
                    Severity: Minor
                    Found in class/CategoryHandler.php by phpmd

                    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 method _isAlbum is not named in camelCase.
                    Open

                        public function _isAlbum($cat)
                        {
                            $nbPhoto = $this->nbPhoto($cat);
                    
                            return 0 != $nbPhoto;
                    Severity: Minor
                    Found in class/CategoryHandler.php by phpmd

                    CamelCaseMethodName

                    Since: 0.2

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

                    Example

                    class ClassName {
                        public function get_name() {
                        }
                    }

                    Source

                    The method _generateTreeData is not named in camelCase.
                    Open

                        public function _generateTreeData(&$arr, $id, $level, &$n)
                        {
                            $arr[$id]['nlevel'] = $level;
                            $arr[$id]['nleft']  = ++$n;
                    
                    
                    Severity: Minor
                    Found in class/CategoryHandler.php by phpmd

                    CamelCaseMethodName

                    Since: 0.2

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

                    Example

                    class ClassName {
                        public function get_name() {
                        }
                    }

                    Source

                    There are no issues that match your filters.

                    Category
                    Status