XoopsModules25x/rss

View on GitHub
class/FeedHandler.php

Summary

Maintainability
D
2 days
Test Coverage

Function getItems has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
Open

    public function getItems(array &$feed): void
    {
        $entries = [];
        $db      = \XoopsDatabaseFactory::getDatabaseConnection();
        if (!empty($feed['plugin'])) {
Severity: Minor
Found in class/FeedHandler.php - About 4 hrs to fix

Cognitive Complexity

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

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

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

Further reading

File FeedHandler.php has 352 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

declare(strict_types=1);

namespace XoopsModules\Rssfit;
Severity: Minor
Found in class/FeedHandler.php - About 4 hrs to fix

    Function getChannel has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
    Open

        public function getChannel(array &$feed): void
        {
            $channel  = [];
            $elements = $this->miscHandler->getObjects2(new \Criteria('misc_category', 'channel'));
            if (\is_array($elements) && !empty($elements)) {
    Severity: Minor
    Found in class/FeedHandler.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

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

        public function doSubstr(string $text): string
        {
            $ret      = $text;
            $len      = \function_exists('mb_strlen') ? mb_strlen($ret, $this->charset) : mb_strlen($ret);
            $maxChars = $this->helper->getConfig('max_char');
    Severity: Minor
    Found in class/FeedHandler.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 getChannel has 48 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function getChannel(array &$feed): void
        {
            $channel  = [];
            $elements = $this->miscHandler->getObjects2(new \Criteria('misc_category', 'channel'));
            if (\is_array($elements) && !empty($elements)) {
    Severity: Minor
    Found in class/FeedHandler.php - About 1 hr to fix

      Method getItems has 47 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function getItems(array &$feed): void
          {
              $entries = [];
              $db      = \XoopsDatabaseFactory::getDatabaseConnection();
              if (!empty($feed['plugin'])) {
      Severity: Minor
      Found in class/FeedHandler.php - About 1 hr to fix

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

            public function feedSelectBox(string $caption = '', $selected = null, int $size = 1, bool $multi = true, bool $none = true, bool $main = true, string $name = 'feeds', string $type = 'id'): \XoopsFormSelect
        Severity: Major
        Found in class/FeedHandler.php - About 1 hr to fix

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

              public function getSticky(array &$feed): bool
              {
                  if (!$intr = $this->miscHandler->getObjects2(new \Criteria('misc_category', 'sticky'))) {
                      return false;
                  }
          Severity: Minor
          Found in class/FeedHandler.php - About 35 mins to fix

          Cognitive Complexity

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

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

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

          Further reading

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

              public function &getActivatedSubfeeds(string $fields = '', string $type = ''): ?array
              {
                  $ret  = null;
                  $subs = $this->pluginHandler->getObjects2(new \Criteria('subfeed', '1'), $fields);
                  if (\is_array($subs) && !empty($subs)) {
          Severity: Minor
          Found in class/FeedHandler.php - About 35 mins to fix

          Cognitive Complexity

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

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

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

          Further reading

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

              public function checkSubFeed(array &$feed): void
              {
                  if (!empty($feed['plugin'])) {
                      $criteria = new \CriteriaCompo();
                      $criteria->add(new \Criteria('rssf_filename', \sprintf($this->pluginFile, $feed['plugin'])));
          Severity: Minor
          Found in class/FeedHandler.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

          There are no issues that match your filters.

          Category
          Status