mambax7/publisher

View on GitHub
class/ItemHandler.php

Summary

Maintainability
F
4 days
Test Coverage

getItemsFromSearch accesses the super-global variable $GLOBALS.
Open

    public function getItemsFromSearch($queryArray = [], $andor = 'AND', $limit = 0, $offset = 0, $userid = 0, $categories = [], $sortby = 0, $searchin = '', $extra = '')
    {
        $count            = 0;
        $ret              = [];
        $criteriaKeywords = $criteriaPermissions = $criteriaUser = null;
Severity: Minor
Found in class/ItemHandler.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

getItemsFromSearch accesses the super-global variable $GLOBALS.
Open

    public function getItemsFromSearch($queryArray = [], $andor = 'AND', $limit = 0, $offset = 0, $userid = 0, $categories = [], $sortby = 0, $searchin = '', $extra = '')
    {
        $count            = 0;
        $ret              = [];
        $criteriaKeywords = $criteriaPermissions = $criteriaUser = null;
Severity: Minor
Found in class/ItemHandler.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

getObjects accesses the super-global variable $GLOBALS.
Open

    public function &getObjects(\CriteriaElement $criteria = null, $idKey = 'none', $as_object = true, $notNullFields = null)
    {
        $limit         = $start = 0;
        $ret           = [];
        $notNullFields = (null !== $notNullFields) ?: '';
Severity: Minor
Found in class/ItemHandler.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 ItemHandler.php has 479 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php declare(strict_types=1);

namespace XoopsModules\Publisher;

/*
Severity: Minor
Found in class/ItemHandler.php - About 7 hrs to fix

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

    class ItemHandler extends \XoopsPersistableObjectHandler
    {
        private const TABLE      = 'publisher_items';
        private const ENTITY     = Item::class;
        private const ENTITYNAME = 'Item';
    Severity: Minor
    Found in class/ItemHandler.php by phpmd

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

        public function getItemsFromSearch($queryArray = [], $andor = 'AND', $limit = 0, $offset = 0, $userid = 0, $categories = [], $sortby = 0, $searchin = '', $extra = '')
        {
            $count            = 0;
            $ret              = [];
            $criteriaKeywords = $criteriaPermissions = $criteriaUser = null;
    Severity: Minor
    Found in class/ItemHandler.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 getItemsFromSearch has 76 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function getItemsFromSearch($queryArray = [], $andor = 'AND', $limit = 0, $offset = 0, $userid = 0, $categories = [], $sortby = 0, $searchin = '', $extra = '')
        {
            $count            = 0;
            $ret              = [];
            $criteriaKeywords = $criteriaPermissions = $criteriaUser = null;
    Severity: Major
    Found in class/ItemHandler.php - About 3 hrs to fix

      ItemHandler has 25 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class ItemHandler extends \XoopsPersistableObjectHandler
      {
          private const TABLE      = 'publisher_items';
          private const ENTITY     = Item::class;
          private const ENTITYNAME = 'Item';
      Severity: Minor
      Found in class/ItemHandler.php - About 2 hrs to fix

        Function getObjects has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
        Open

            public function &getObjects(\CriteriaElement $criteria = null, $idKey = 'none', $as_object = true, $notNullFields = null)
            {
                $limit         = $start = 0;
                $ret           = [];
                $notNullFields = (null !== $notNullFields) ?: '';
        Severity: Minor
        Found in class/ItemHandler.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 getObjects has 44 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function &getObjects(\CriteriaElement $criteria = null, $idKey = 'none', $as_object = true, $notNullFields = null)
            {
                $limit         = $start = 0;
                $ret           = [];
                $notNullFields = (null !== $notNullFields) ?: '';
        Severity: Minor
        Found in class/ItemHandler.php - About 1 hr to fix

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

              public function insert(\XoopsObject $item, $force = false)  //insert(&$item, $force = false)
              {
                  if (!$item->meta_keywords() || !$item->meta_description() || !$item->short_url()) {
                      $publisherMetagen = new Metagen($item->getTitle(), $item->getVar('meta_keywords'), $item->getVar('summary'));
                      // Auto create meta tags if empty
          Severity: Minor
          Found in class/ItemHandler.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 getItems has 10 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              public function getItems($limit = 0, $start = 0, $status = '', $categoryid = -1, $sort = 'datesub', $order = 'DESC', $notNullFields = null, $asObject = true, $otherCriteria = null, $idKey = 'none')
          Severity: Major
          Found in class/ItemHandler.php - About 1 hr to fix

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

                public function getCount(\CriteriaElement $criteria = null, $notNullFields = null)
                {
                    //        $notNullFields = $notNullFields ?? null;
                    $sql = 'SELECT COUNT(*) FROM ' . $this->db->prefix($this->helper->getDirname() . '_items');
                    if (null !== $criteria && ($criteria instanceof \Criteria || $criteria instanceof \CriteriaCompo)) {
            Severity: Minor
            Found in class/ItemHandler.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 getCountsByCat has 30 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function getCountsByCat($catId, $status, $inSubCat = false)
                {
                    //        global $resultCatCounts;
            
                    $ret       = [];
            Severity: Minor
            Found in class/ItemHandler.php - About 1 hr to fix

              Method getItemsFromSearch has 9 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  public function getItemsFromSearch($queryArray = [], $andor = 'AND', $limit = 0, $offset = 0, $userid = 0, $categories = [], $sortby = 0, $searchin = '', $extra = '')
              Severity: Major
              Found in class/ItemHandler.php - About 1 hr to fix

                Method getAllPublished has 9 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    public function getAllPublished($limit = 0, $start = 0, $categoryid = -1, $sort = 'datesub', $order = 'DESC', $notNullFields = null, $asObject = true, $idKey = 'none', $excludeExpired = true)
                Severity: Major
                Found in class/ItemHandler.php - About 1 hr to fix

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

                      public function getCountsByCat($catId, $status, $inSubCat = false)
                      {
                          //        global $resultCatCounts;
                  
                          $ret       = [];
                  Severity: Minor
                  Found in class/ItemHandler.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 getAllOffline has 8 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      public function getAllOffline($limit = 0, $start = 0, $categoryid = -1, $sort = 'datesub', $order = 'DESC', $notNullFields = '', $asObject = true, $idKey = 'none')
                  Severity: Major
                  Found in class/ItemHandler.php - About 1 hr to fix

                    Method getAllExpired has 8 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        public function getAllExpired($limit = 0, $start = 0, $categoryid = -1, $sort = 'datesub', $order = 'DESC', $notNullFields = null, $asObject = true, $idKey = 'none')
                    Severity: Major
                    Found in class/ItemHandler.php - About 1 hr to fix

                      Method getAllSubmitted has 8 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                          public function getAllSubmitted($limit = 0, $start = 0, $categoryid = -1, $sort = 'datesub', $order = 'DESC', $notNullFields = null, $asObject = true, $idKey = 'none')
                      Severity: Major
                      Found in class/ItemHandler.php - About 1 hr to fix

                        Method getAllRejected has 8 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                            public function getAllRejected($limit = 0, $start = 0, $categoryid = -1, $sort = 'datesub', $order = 'DESC', $notNullFields = '', $asObject = true, $idKey = 'none')
                        Severity: Major
                        Found in class/ItemHandler.php - About 1 hr to fix

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

                              private function getItemsCriteria($categoryid = -1, $status = '', $notNullFields = null, $criteriaPermissions = null)
                              {
                                  //        $notNullFields = (null !== $notNullFields) ?: '';
                                  //        global $publisherIsAdmin;
                                  //        $ret = 0;
                          Severity: Minor
                          Found in class/ItemHandler.php - About 55 mins to fix

                          Cognitive Complexity

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

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

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

                          Further reading

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

                              public function notNullFieldClause($notNullFields = '', $withAnd = false)
                              {
                                  $ret = '';
                                  if ($withAnd) {
                                      $ret .= ' AND ';
                          Severity: Minor
                          Found in class/ItemHandler.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 getObjects() has an NPath complexity of 576. The configured NPath complexity threshold is 200.
                          Open

                              public function &getObjects(\CriteriaElement $criteria = null, $idKey = 'none', $as_object = true, $notNullFields = null)
                              {
                                  $limit         = $start = 0;
                                  $ret           = [];
                                  $notNullFields = (null !== $notNullFields) ?: '';
                          Severity: Minor
                          Found in class/ItemHandler.php by phpmd

                          NPathComplexity

                          Since: 0.1

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

                          Example

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

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

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

                              public function getItemsFromSearch($queryArray = [], $andor = 'AND', $limit = 0, $offset = 0, $userid = 0, $categories = [], $sortby = 0, $searchin = '', $extra = '')
                              {
                                  $count            = 0;
                                  $ret              = [];
                                  $criteriaKeywords = $criteriaPermissions = $criteriaUser = null;
                          Severity: Minor
                          Found in class/ItemHandler.php by phpmd

                          The method getItemsFromSearch() has an NPath complexity of 256000. The configured NPath complexity threshold is 200.
                          Open

                              public function getItemsFromSearch($queryArray = [], $andor = 'AND', $limit = 0, $offset = 0, $userid = 0, $categories = [], $sortby = 0, $searchin = '', $extra = '')
                              {
                                  $count            = 0;
                                  $ret              = [];
                                  $criteriaKeywords = $criteriaPermissions = $criteriaUser = null;
                          Severity: Minor
                          Found in class/ItemHandler.php by phpmd

                          NPathComplexity

                          Since: 0.1

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

                          Example

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

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

                          The method getItems has 10 parameters. Consider reducing the number of parameters to less than 10.
                          Open

                              public function getItems($limit = 0, $start = 0, $status = '', $categoryid = -1, $sort = 'datesub', $order = 'DESC', $notNullFields = null, $asObject = true, $otherCriteria = null, $idKey = 'none')
                              {
                                  $notNullFields       = (null !== $notNullFields) ?: '';
                                  $criteriaPermissions = null;
                                  if (!$this->publisherIsAdmin) {
                          Severity: Minor
                          Found in class/ItemHandler.php by phpmd

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

                              private function getItemsCriteria($categoryid = -1, $status = '', $notNullFields = null, $criteriaPermissions = null)
                              {
                                  //        $notNullFields = (null !== $notNullFields) ?: '';
                                  //        global $publisherIsAdmin;
                                  //        $ret = 0;
                          Severity: Minor
                          Found in class/ItemHandler.php by phpmd

                          CyclomaticComplexity

                          Since: 0.1

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

                          Example

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

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

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

                              public function &getObjects(\CriteriaElement $criteria = null, $idKey = 'none', $as_object = true, $notNullFields = null)
                              {
                                  $limit         = $start = 0;
                                  $ret           = [];
                                  $notNullFields = (null !== $notNullFields) ?: '';
                          Severity: Minor
                          Found in class/ItemHandler.php by phpmd

                          CyclomaticComplexity

                          Since: 0.1

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

                          Example

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

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

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

                              public function getItemsFromSearch($queryArray = [], $andor = 'AND', $limit = 0, $offset = 0, $userid = 0, $categories = [], $sortby = 0, $searchin = '', $extra = '')
                              {
                                  $count            = 0;
                                  $ret              = [];
                                  $criteriaKeywords = $criteriaPermissions = $criteriaUser = null;
                          Severity: Minor
                          Found in class/ItemHandler.php by phpmd

                          CyclomaticComplexity

                          Since: 0.1

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

                          Example

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

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

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

                              public function insert(\XoopsObject $item, $force = false)  //insert(&$item, $force = false)
                              {
                                  if (!$item->meta_keywords() || !$item->meta_description() || !$item->short_url()) {
                                      $publisherMetagen = new Metagen($item->getTitle(), $item->getVar('meta_keywords'), $item->getVar('summary'));
                                      // Auto create meta tags if empty
                          Severity: Minor
                          Found in class/ItemHandler.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 '322', column '40').
                          Open

                                      $criteriaPermissions = new \CriteriaCompo();
                          Severity: Minor
                          Found in class/ItemHandler.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 '389', column '33').
                          Open

                                  $otherCriteria->add(new \Criteria('dateexpire', \time(), '<='));
                          Severity: Minor
                          Found in class/ItemHandler.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 '282', column '37').
                          Open

                                      $criteriaCategory = new \Criteria('categoryid', $categoryid);
                          Severity: Minor
                          Found in class/ItemHandler.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 '364', column '35').
                          Open

                                      $criteriaExpire = new \CriteriaCompo();
                          Severity: Minor
                          Found in class/ItemHandler.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 '674', column '33').
                          Open

                                      $criteriaUser = new \CriteriaCompo();
                          Severity: Minor
                          Found in class/ItemHandler.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 '285', column '31').
                          Open

                                  $criteriaStatus = new \CriteriaCompo();
                          Severity: Minor
                          Found in class/ItemHandler.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 '422', column '33').
                          Open

                                  $otherCriteria->add(new \Criteria('datesub', $obj->getVar('datesub'), '>'));
                          Severity: Minor
                          Found in class/ItemHandler.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 '710', column '40').
                          Open

                                      $criteriaPermissions = new \CriteriaCompo();
                          Severity: Minor
                          Found in class/ItemHandler.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 '504', column '40').
                          Open

                                      $criteriaPermissions = new \CriteriaCompo();
                          Severity: Minor
                          Found in class/ItemHandler.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 '675', column '36').
                          Open

                                      $criteriaUser->add(new \Criteria('uid', $userid), 'OR');
                          Severity: Minor
                          Found in class/ItemHandler.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 insert has a boolean flag argument $force, which is a certain sign of a Single Responsibility Principle violation.
                          Open

                              public function insert(\XoopsObject $item, $force = false)  //insert(&$item, $force = false)
                          Severity: Minor
                          Found in class/ItemHandler.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 getObjects has a boolean flag argument $as_object, which is a certain sign of a Single Responsibility Principle violation.
                          Open

                              public function &getObjects(\CriteriaElement $criteria = null, $idKey = 'none', $as_object = true, $notNullFields = null)
                          Severity: Minor
                          Found in class/ItemHandler.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 getAllPublished has a boolean flag argument $asObject, which is a certain sign of a Single Responsibility Principle violation.
                          Open

                              public function getAllPublished($limit = 0, $start = 0, $categoryid = -1, $sort = 'datesub', $order = 'DESC', $notNullFields = null, $asObject = true, $idKey = 'none', $excludeExpired = true)
                          Severity: Minor
                          Found in class/ItemHandler.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 '388', column '30').
                          Open

                                  $otherCriteria = new \CriteriaCompo();
                          Severity: Minor
                          Found in class/ItemHandler.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 '291', column '38').
                          Open

                                      $criteriaStatus->add(new \Criteria('status', $status), 'OR');
                          Severity: Minor
                          Found in class/ItemHandler.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 '724', column '40').
                          Open

                                      $grantedCategories   = new \Criteria('categoryid', '(' . \implode(',', $categories) . ')', 'IN');
                          Severity: Minor
                          Found in class/ItemHandler.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 getCountsByCat has a boolean flag argument $inSubCat, which is a certain sign of a Single Responsibility Principle violation.
                          Open

                              public function getCountsByCat($catId, $status, $inSubCat = false)
                          Severity: Minor
                          Found in class/ItemHandler.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 '403', column '30').
                          Open

                                  $otherCriteria = new \CriteriaCompo();
                          Severity: Minor
                          Found in class/ItemHandler.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 '421', column '30').
                          Open

                                  $otherCriteria = new \CriteriaCompo();
                          Severity: Minor
                          Found in class/ItemHandler.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 '423', column '33').
                          Open

                                  $otherCriteria->add(new \Criteria('datesub', \time(), '<='));
                          Severity: Minor
                          Found in class/ItemHandler.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 '684', column '40').
                          Open

                                          $criteriaKeyword = new \CriteriaCompo();
                          Severity: Minor
                          Found in class/ItemHandler.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 getAllPublished has a boolean flag argument $excludeExpired, which is a certain sign of a Single Responsibility Principle violation.
                          Open

                              public function getAllPublished($limit = 0, $start = 0, $categoryid = -1, $sort = 'datesub', $order = 'DESC', $notNullFields = null, $asObject = true, $idKey = 'none', $excludeExpired = true)
                          Severity: Minor
                          Found in class/ItemHandler.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 '390', column '33').
                          Open

                                  $otherCriteria->add(new \Criteria('dateexpire', 0, '>'));
                          Severity: Minor
                          Found in class/ItemHandler.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 '294', column '25').
                          Open

                                  $criteria = new \CriteriaCompo();
                          Severity: Minor
                          Found in class/ItemHandler.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 getAllRejected has a boolean flag argument $asObject, which is a certain sign of a Single Responsibility Principle violation.
                          Open

                              public function getAllRejected($limit = 0, $start = 0, $categoryid = -1, $sort = 'datesub', $order = 'DESC', $notNullFields = '', $asObject = true, $idKey = 'none')
                          Severity: Minor
                          Found in class/ItemHandler.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 '404', column '33').
                          Open

                                  $otherCriteria->add(new \Criteria('datesub', $obj->getVar('datesub'), '<'));
                          Severity: Minor
                          Found in class/ItemHandler.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 '365', column '38').
                          Open

                                      $criteriaExpire->add(new \Criteria('dateexpire', '0'), 'OR');
                          Severity: Minor
                          Found in class/ItemHandler.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 getAllSubmitted has a boolean flag argument $asObject, which is a certain sign of a Single Responsibility Principle violation.
                          Open

                              public function getAllSubmitted($limit = 0, $start = 0, $categoryid = -1, $sort = 'datesub', $order = 'DESC', $notNullFields = null, $asObject = true, $idKey = 'none')
                          Severity: Minor
                          Found in class/ItemHandler.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 '682', column '37').
                          Open

                                      $criteriaKeywords = new \CriteriaCompo();
                          Severity: Minor
                          Found in class/ItemHandler.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 getAllExpired has a boolean flag argument $asObject, which is a certain sign of a Single Responsibility Principle violation.
                          Open

                              public function getAllExpired($limit = 0, $start = 0, $categoryid = -1, $sort = 'datesub', $order = 'DESC', $notNullFields = null, $asObject = true, $idKey = 'none')
                          Severity: Minor
                          Found in class/ItemHandler.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 deleteAll has a boolean flag argument $asObject, which is a certain sign of a Single Responsibility Principle violation.
                          Open

                              public function deleteAll(\CriteriaElement $criteria = null, $force = true, $asObject = false) //deleteAll($criteria = null)
                          Severity: Minor
                          Found in class/ItemHandler.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 notNullFieldClause has a boolean flag argument $withAnd, which is a certain sign of a Single Responsibility Principle violation.
                          Open

                              public function notNullFieldClause($notNullFields = '', $withAnd = false)
                          Severity: Minor
                          Found in class/ItemHandler.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 '672', column '36').
                          Open

                                      $criteriaUser->add(new \Criteria('uid', '(' . \implode(',', $userid) . ')', 'IN'), 'OR');
                          Severity: Minor
                          Found in class/ItemHandler.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 '686', column '47').
                          Open

                                              $criteriaKeyword->add(new \Criteria($searchField, '%' . $iValue . '%', 'LIKE'), 'OR');
                          Severity: Minor
                          Found in class/ItemHandler.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 '729', column '25').
                          Open

                                  $criteria = new \CriteriaCompo();
                          Severity: Minor
                          Found in class/ItemHandler.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 '357', column '30').
                          Open

                                  $otherCriteria = new \CriteriaCompo();
                          Severity: Minor
                          Found in class/ItemHandler.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 getItems has a boolean flag argument $asObject, which is a certain sign of a Single Responsibility Principle violation.
                          Open

                              public function getItems($limit = 0, $start = 0, $status = '', $categoryid = -1, $sort = 'datesub', $order = 'DESC', $notNullFields = null, $asObject = true, $otherCriteria = null, $idKey = 'none')
                          Severity: Minor
                          Found in class/ItemHandler.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 delete has a boolean flag argument $force, which is a certain sign of a Single Responsibility Principle violation.
                          Open

                              public function delete(\XoopsObject $item, $force = false)
                          Severity: Minor
                          Found in class/ItemHandler.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 '509', column '42').
                          Open

                                          $grantedCategories = new \Criteria('categoryid', '(' . \implode(',', $categoriesGranted) . ')', 'IN');
                          Severity: Minor
                          Found in class/ItemHandler.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 create has a boolean flag argument $isNew, which is a certain sign of a Single Responsibility Principle violation.
                          Open

                              public function create($isNew = true)
                          Severity: Minor
                          Found in class/ItemHandler.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 '288', column '42').
                          Open

                                          $criteriaStatus->add(new \Criteria('status', $v), 'OR');
                          Severity: Minor
                          Found in class/ItemHandler.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 '671', column '33').
                          Open

                                      $criteriaUser = new \CriteriaCompo();
                          Severity: Minor
                          Found in class/ItemHandler.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 '727', column '36').
                          Open

                                  $criteriaItemsStatus = new \CriteriaCompo();
                          Severity: Minor
                          Found in class/ItemHandler.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 '728', column '39').
                          Open

                                  $criteriaItemsStatus->add(new \Criteria('status', Constants::PUBLISHER_STATUS_PUBLISHED));
                          Severity: Minor
                          Found in class/ItemHandler.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 '359', column '36').
                          Open

                                      $criteriaDateSub = new \Criteria('datesub', \time(), '<=');
                          Severity: Minor
                          Found in class/ItemHandler.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 '366', column '38').
                          Open

                                      $criteriaExpire->add(new \Criteria('dateexpire', \time(), '>='), 'OR');
                          Severity: Minor
                          Found in class/ItemHandler.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 getAllOffline has a boolean flag argument $asObject, which is a certain sign of a Single Responsibility Principle violation.
                          Open

                              public function getAllOffline($limit = 0, $start = 0, $categoryid = -1, $sort = 'datesub', $order = 'DESC', $notNullFields = '', $asObject = true, $idKey = 'none')
                          Severity: Minor
                          Found in class/ItemHandler.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 '720', column '38').
                          Open

                                      $grantedCategories = new \Criteria('categoryid', '(' . \implode(',', $categoriesGranted) . ')', 'IN');
                          Severity: Minor
                          Found in class/ItemHandler.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 '723', column '40').
                          Open

                                      $criteriaPermissions = new \CriteriaCompo();
                          Severity: Minor
                          Found in class/ItemHandler.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 '327', column '42').
                          Open

                                          $grantedCategories = new \Criteria('categoryid', '(' . \implode(',', $categoriesGranted) . ')', 'IN');
                          Severity: Minor
                          Found in class/ItemHandler.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 deleteAll has a boolean flag argument $force, which is a certain sign of a Single Responsibility Principle violation.
                          Open

                              public function deleteAll(\CriteriaElement $criteria = null, $force = true, $asObject = false) //deleteAll($criteria = null)
                          Severity: Minor
                          Found in class/ItemHandler.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

                          Avoid using static access to class 'XoopsModules\Publisher\Helper' in method '__construct'.
                          Open

                                  $this->helper           = $helper ?? Helper::getInstance();
                          Severity: Minor
                          Found in class/ItemHandler.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

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

                                      } else {
                                          return 0;
                                      }
                          Severity: Minor
                          Found in class/ItemHandler.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\Publisher\Metagen' in method 'insert'.
                          Open

                                          $item->setVar('short_url', \mb_substr(Metagen::generateSeoTitle($item->getVar('title', 'n'), false), 0, 254));
                          Severity: Minor
                          Found in class/ItemHandler.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

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

                                      } else {
                                          $ret[$theObject->getVar($idKey)][$theObject->itemid()] = $theObject;
                                      }
                          Severity: Minor
                          Found in class/ItemHandler.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 getItems uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                          Open

                                      } else {
                                          return [];
                                      }
                          Severity: Minor
                          Found in class/ItemHandler.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 getCountsByCat uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                          Open

                                  } else {
                                      $sql .= ' WHERE i.status IN (' . \implode(',', $status) . ')';
                                  }
                          Severity: Minor
                          Found in class/ItemHandler.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 unused parameters such as '$notNullFields'.
                          Open

                              private function getItemsCriteria($categoryid = -1, $status = '', $notNullFields = null, $criteriaPermissions = null)
                          Severity: Minor
                          Found in class/ItemHandler.php by phpmd

                          UnusedFormalParameter

                          Since: 0.2

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

                          Example

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

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

                          Avoid unused parameters such as '$asObject'.
                          Open

                              public function deleteAll(\CriteriaElement $criteria = null, $force = true, $asObject = false) //deleteAll($criteria = null)
                          Severity: Minor
                          Found in class/ItemHandler.php by phpmd

                          UnusedFormalParameter

                          Since: 0.2

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

                          Example

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

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

                          Avoid unused parameters such as '$asObject'.
                          Open

                              public function getItems($limit = 0, $start = 0, $status = '', $categoryid = -1, $sort = 'datesub', $order = 'DESC', $notNullFields = null, $asObject = true, $otherCriteria = null, $idKey = 'none')
                          Severity: Minor
                          Found in class/ItemHandler.php by phpmd

                          UnusedFormalParameter

                          Since: 0.2

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

                          Example

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

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

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

                                      $item = $this->getItems(1, $entryNumber, $status, $categoryid, $sort = 'datesub', $order = 'DESC', $notNullFields);
                          Severity: Minor
                          Found in class/ItemHandler.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

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

                                  $count            = 0;
                          Severity: Minor
                          Found in class/ItemHandler.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

                          Avoid unused parameters such as '$as_object'.
                          Open

                              public function &getObjects(\CriteriaElement $criteria = null, $idKey = 'none', $as_object = true, $notNullFields = null)
                          Severity: Minor
                          Found in class/ItemHandler.php by phpmd

                          UnusedFormalParameter

                          Since: 0.2

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

                          Example

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

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

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

                                      $item = $this->getItems(1, $entryNumber, $status, $categoryid, $sort = 'datesub', $order = 'DESC', $notNullFields);
                          Severity: Minor
                          Found in class/ItemHandler.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

                          Avoid unused parameters such as '$extra'.
                          Open

                              public function getItemsFromSearch($queryArray = [], $andor = 'AND', $limit = 0, $offset = 0, $userid = 0, $categories = [], $sortby = 0, $searchin = '', $extra = '')
                          Severity: Minor
                          Found in class/ItemHandler.php by phpmd

                          UnusedFormalParameter

                          Since: 0.2

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

                          Example

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

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

                          Avoid unused parameters such as '$fields'.
                          Open

                              public function get($id = null, $fields = null)
                          Severity: Minor
                          Found in class/ItemHandler.php by phpmd

                          UnusedFormalParameter

                          Since: 0.2

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

                          Example

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

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

                          Avoid unused parameters such as '$force'.
                          Open

                              public function deleteAll(\CriteriaElement $criteria = null, $force = true, $asObject = false) //deleteAll($criteria = null)
                          Severity: Minor
                          Found in class/ItemHandler.php by phpmd

                          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

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

                              public function getAllOffline($limit = 0, $start = 0, $categoryid = -1, $sort = 'datesub', $order = 'DESC', $notNullFields = '', $asObject = true, $idKey = 'none')
                              {
                                  return $this->getItems($limit, $start, [Constants::PUBLISHER_STATUS_OFFLINE], $categoryid, $sort, $order, $notNullFields, $asObject, null, $idKey);
                              }
                          Severity: Major
                          Found in class/ItemHandler.php and 1 other location - About 1 hr to fix
                          class/ItemHandler.php on lines 480..483

                          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 103.

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

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

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

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

                          Refactorings

                          Further Reading

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

                              public function getAllRejected($limit = 0, $start = 0, $categoryid = -1, $sort = 'datesub', $order = 'DESC', $notNullFields = '', $asObject = true, $idKey = 'none')
                              {
                                  return $this->getItems($limit, $start, [Constants::PUBLISHER_STATUS_REJECTED], $categoryid, $sort, $order, $notNullFields, $asObject, null, $idKey);
                              }
                          Severity: Major
                          Found in class/ItemHandler.php and 1 other location - About 1 hr to fix
                          class/ItemHandler.php on lines 463..466

                          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 103.

                          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

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

                              public function __construct(\XoopsDatabase $db = null, Helper $helper = null)
                              {
                                  $this->helper           = $helper ?? Helper::getInstance();
                                  $this->db               = $db;
                                  $this->publisherIsAdmin = $this->helper->isUserAdmin();
                          Severity: Major
                          Found in class/ItemHandler.php and 1 other location - About 1 hr to fix
                          class/CategoryHandler.php on lines 44..51

                          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 102.

                          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

                          The parameter $as_object is not named in camelCase.
                          Open

                              public function &getObjects(\CriteriaElement $criteria = null, $idKey = 'none', $as_object = true, $notNullFields = null)
                              {
                                  $limit         = $start = 0;
                                  $ret           = [];
                                  $notNullFields = (null !== $notNullFields) ?: '';
                          Severity: Minor
                          Found in class/ItemHandler.php by phpmd

                          CamelCaseParameterName

                          Since: 0.2

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

                          Example

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

                          Source

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

                              public function __construct(\XoopsDatabase $db = null, Helper $helper = null)
                          Severity: Minor
                          Found in class/ItemHandler.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 get($id = null, $fields = null)
                          Severity: Minor
                          Found in class/ItemHandler.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

                          A file should declare new symbols (classes, functions, constants, etc.) and cause no other side effects, or it should execute logic with side effects, but should not do both. The first symbol is defined on line 34 and the first side effect is on line 25.
                          Open

                          <?php declare(strict_types=1);
                          Severity: Minor
                          Found in class/ItemHandler.php by phpcodesniffer

                          Scope keyword "public" must be followed by a single space
                          Open

                              public    $helper;
                          Severity: Minor
                          Found in class/ItemHandler.php by phpcodesniffer

                          Scope keyword "public" must be followed by a single space
                          Open

                              public    $publisherIsAdmin;
                          Severity: Minor
                          Found in class/ItemHandler.php by phpcodesniffer

                          The 'getPreviousPublished()' method which returns a boolean should be named 'is...()' or 'has...()'
                          Open

                              public function getPreviousPublished($obj)
                              {
                                  $ret           = false;
                                  $otherCriteria = new \CriteriaCompo();
                                  $otherCriteria->add(new \Criteria('datesub', $obj->getVar('datesub'), '<'));
                          Severity: Minor
                          Found in class/ItemHandler.php by phpmd

                          BooleanGetMethodName

                          Since: 0.2

                          Looks for methods named 'getX()' with 'boolean' as the return type. The convention is to name these methods 'isX()' or 'hasX()'.

                          Example

                          class Foo {
                              /**
                               * @return boolean
                               */
                              public function getFoo() {} // bad
                              /**
                               * @return bool
                               */
                              public function isFoo(); // ok
                              /**
                               * @return boolean
                               */
                              public function getFoo($bar); // ok, unless checkParameterizedMethods=true
                          }

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

                          The 'getNextPublished()' method which returns a boolean should be named 'is...()' or 'has...()'
                          Open

                              public function getNextPublished($obj)
                              {
                                  $ret           = false;
                                  $otherCriteria = new \CriteriaCompo();
                                  $otherCriteria->add(new \Criteria('datesub', $obj->getVar('datesub'), '>'));
                          Severity: Minor
                          Found in class/ItemHandler.php by phpmd

                          BooleanGetMethodName

                          Since: 0.2

                          Looks for methods named 'getX()' with 'boolean' as the return type. The convention is to name these methods 'isX()' or 'hasX()'.

                          Example

                          class Foo {
                              /**
                               * @return boolean
                               */
                              public function getFoo() {} // bad
                              /**
                               * @return bool
                               */
                              public function isFoo(); // ok
                              /**
                               * @return boolean
                               */
                              public function getFoo($bar); // ok, unless checkParameterizedMethods=true
                          }

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

                          The 'getRandomItem()' method which returns a boolean should be named 'is...()' or 'has...()'
                          Open

                              public function getRandomItem($field = '', $status = '', $categoryid = -1)
                              {
                                  $ret           = false;
                                  $notNullFields = $field;
                                  // Getting the number of published Items
                          Severity: Minor
                          Found in class/ItemHandler.php by phpmd

                          BooleanGetMethodName

                          Since: 0.2

                          Looks for methods named 'getX()' with 'boolean' as the return type. The convention is to name these methods 'isX()' or 'hasX()'.

                          Example

                          class Foo {
                              /**
                               * @return boolean
                               */
                              public function getFoo() {} // bad
                              /**
                               * @return bool
                               */
                              public function isFoo(); // ok
                              /**
                               * @return boolean
                               */
                              public function getFoo($bar); // ok, unless checkParameterizedMethods=true
                          }

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

                          Only one argument is allowed per line in a multi-line function call
                          Open

                                          'category_read', $groups, $this->helper->getModule()
                          Severity: Minor
                          Found in class/ItemHandler.php by phpcodesniffer

                          Only one argument is allowed per line in a multi-line function call
                          Open

                                          'category_read', $groups, $this->helper->getModule()
                          Severity: Minor
                          Found in class/ItemHandler.php by phpcodesniffer

                          There are no issues that match your filters.

                          Category
                          Status