mambax7/publisher

View on GitHub

Showing 3,032 of 3,032 total issues

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

      Method xoops_module_install_publisher has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function xoops_module_install_publisher(\XoopsModule $module)
      {
          require \dirname(__DIR__) . '/preloads/autoloader.php';
      
          $helper       = Helper::getInstance();
      Severity: Minor
      Found in include/oninstall.php - About 1 hr to fix

        Method serveExternalImage has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected function serveExternalImage()
            {
                if (!preg_match('/^https?:\/\/[a-zA-Z0-9\-\.]+/i', $this->src)) {
                    $this->error('Invalid URL supplied.');
        
        
        Severity: Minor
        Found in thumb.php - About 1 hr to fix

          Method insert has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function insert(\XoopsObject $obj, $force = false)// insert($obj, $force = false)
              {
                  // Make sure object is of correct type
                  if (0 != \strcasecmp($this->className, \get_class($obj))) {
                      return false;
          Severity: Minor
          Found in class/BaseObjectHandler.php - About 1 hr to fix

            Method getGrantedGroupsById has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function getGrantedGroupsById($gpermName, $id)
                {
                    static $items;
                    if (isset($items[$gpermName][$id])) {
                        return $items[$gpermName][$id];
            Severity: Minor
            Found in class/PermissionHandler.php - About 1 hr to fix

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

              function publisher_tag_iteminfo(&$items)
              {
                  if (empty($items) || !is_array($items)) {
                      return false;
                  }
              Severity: Minor
              Found in include/plugin.tag.php - About 1 hr to fix

              Cognitive Complexity

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

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

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

              Further reading

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

              function xoops_module_install_publisher(\XoopsModule $module)
              {
                  require \dirname(__DIR__) . '/preloads/autoloader.php';
              
                  $helper       = Helper::getInstance();
              Severity: Minor
              Found in include/oninstall.php - About 1 hr to fix

              Cognitive Complexity

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

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

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

              Further reading

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

                  public function findMetaKeywords($text, $minChar)
                  {
                      $keywords         = [];
                      $text             = $this->purifyText($text);
                      $text             = $this->html2text($text);
              Severity: Minor
              Found in class/Metagen.php - About 1 hr to fix

              Cognitive Complexity

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

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

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

              Further reading

              Function 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

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

                  public function setTitle($title): void
                  {
                      $this->title         = $this->html2text($title);
                      $this->originalTitle = $this->title;
                      $titleTag            = [];
              Severity: Minor
              Found in class/Metagen.php - About 1 hr to fix

              Cognitive Complexity

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

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

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

              Further reading

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

                  public function getCategoriesForSearch()
                  {
                      global $theresult;
              
                      $ret      = [];
              Severity: Minor
              Found in class/CategoryHandler.php - About 1 hr to fix

              Cognitive Complexity

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

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

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

              Further reading

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

                  public function getArray($mimeExt = null)
                  {
                      //        global $publisherIsAdmin;
                      $ret = [];
                      if ($GLOBALS['xoopsUser'] && !$this->publisherIsAdmin) {
              Severity: Minor
              Found in class/MimetypeHandler.php - About 1 hr to fix

              Cognitive Complexity

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

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

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

              Further reading

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

                  public function &getCategoriesForSubmit()
                  {
                      global $theresult;
                      $ret      = [];
                      $criteria = new \CriteriaCompo();
              Severity: Minor
              Found in class/CategoryHandler.php - About 1 hr to fix

              Cognitive Complexity

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

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

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

              Further reading

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

                  public function getGrantedItems($gpermName)
                  {
                      static $items;
                      if (isset($items[$gpermName])) {
                          return $items[$gpermName];
              Severity: Minor
              Found in class/PermissionHandler.php - About 1 hr to fix

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

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

                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

                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

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

                    public static function editFile($showmenu = false, $fileid = 0, $itemId = 0): void
                    {
                        $helper = Helper::getInstance();
                        require_once $GLOBALS['xoops']->path('class/xoopsformloader.php');
                
                
                Severity: Minor
                Found in class/Utility.php - About 1 hr to fix

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

                  $modversion['config'][] = [
                      'name'        => 'submit_status',
                      'title'       => '_MI_PUBLISHER_FORM_STATUS',
                      'description' => '_MI_PUBLISHER_FORM_STATUS_DSC',
                      'formtype'    => 'select',
                  Severity: Major
                  Found in xoops_version.php and 1 other location - About 1 hr to fix
                  xoops_version.php on lines 1568..1582

                  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

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

                  $modversion['config'][] = [
                      'name'        => 'submit_edit_status',
                      'title'       => '_MI_PUBLISHER_FORM_EDIT_STATUS',
                      'description' => '_MI_PUBLISHER_FORM_EDIT_STATUS_DSC',
                      'formtype'    => 'select',
                  Severity: Major
                  Found in xoops_version.php and 1 other location - About 1 hr to fix
                  xoops_version.php on lines 1552..1566

                  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

                  Severity
                  Category
                  Status
                  Source
                  Language