mambax7/publisher

View on GitHub

Showing 355 of 3,032 total issues

Method getImages has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function getImages()
    {
        static $ret;
        $itemId = (int)$this->getVar('itemid');
        if (!isset($ret[$itemId])) {
Severity: Minor
Found in class/Item.php - About 1 hr to fix

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

        public function run()
        {
            if ($this->isURL) {
                if (!ALLOW_EXTERNAL) {
                    $this->debug(1, 'Got a request for an external image but ALLOW_EXTERNAL is disabled so returning error msg.');
    Severity: Minor
    Found in thumb.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 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

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

          public static function ratingBar($itemId)
          {
              $helper          = Helper::getInstance();
              $ratingUnitWidth = 30;
              $units           = 5;
      Severity: Minor
      Found in class/Utility.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 createDir has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function createDir(): void
          {
              // auto crate folders
              //        $thePath = static::getUploadDir();
      
      
      Severity: Minor
      Found in class/Utility.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 rrmdir has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function rrmdir($src)
          {
              // Only continue if user is a 'global' Admin
              if (!($GLOBALS['xoopsUser'] instanceof \XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) {
                  return false;
      Severity: Minor
      Found in class/Common/FilesManagement.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 manage has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function manage($icons): void
          {
              $helper  = Helper::getInstance();
              $utility = new Utility();
              /** @var MimetypeHandler $mimetypeHandler */
      Severity: Minor
      Found in class/MimetypesUtility.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 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

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

          public function storeUpload($postField, $allowedMimetypes, &$errors)
          {
              /** @var MimetypeHandler $mimetypeHandler */
              $mimetypeHandler = $this->helper->getHandler('Mimetype');
              $itemId          = $this->getVar('itemid');
      Severity: Minor
      Found in class/File.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 cleanCache has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function cleanCache()
          {
              if (FILE_CACHE_TIME_BETWEEN_CLEANS < 0) {
                  return null;
              }
      Severity: Minor
      Found in thumb.php - About 1 hr to fix

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

            private function getKey(string $line): array
            {
                $key = [];
        
                if (\strpos($line, 'RIMARY') > 0) {
        Severity: Minor
        Found in class/Common/MigrateHelper.php - About 1 hr to fix

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

          function loadTableFromArrayWithReplace($table, $data, $search, $replace)
          {
              /** @var \XoopsMySQLDatabase $db */
              $db = \XoopsDatabaseFactory::getDatabaseConnection();
          
          
          Severity: Minor
          Found in testdata/index.php - About 1 hr to fix

            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 getServerStats has 30 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public static function getServerStats()
                  {
                      //mb    $wfdownloads = WfdownloadsWfdownloads::getInstance();
                      $moduleDirName      = \basename(\dirname(__DIR__, 2));
                      $moduleDirNameUpper = \mb_strtoupper($moduleDirName);
              Severity: Minor
              Found in class/Common/ServerStats.php - About 1 hr to fix

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

                    public function storeUpload($postField, $allowedMimetypes, &$errors)
                    {
                        /** @var MimetypeHandler $mimetypeHandler */
                        $mimetypeHandler = $this->helper->getHandler('Mimetype');
                        $itemId          = $this->getVar('itemid');
                Severity: Minor
                Found in class/File.php - About 1 hr to fix

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

                      public function getFormConfirm(): \XoopsThemeForm
                      {
                          $moduleDirName      = \basename(__DIR__);
                          $moduleDirNameUpper = \mb_strtoupper($moduleDirName);
                          //in order to be accessable from user and admin area this should be place in language common.php
                  Severity: Minor
                  Found in class/Common/Confirm.php - About 1 hr to fix

                    Function onload has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                                    preloader.onload = function () {
                    
                                        // remove loading class
                                        ppyStageWrap.removeClass(lclass);
                    
                    
                    Severity: Minor
                    Found in assets/js/jquery.popeye-2.1.js - About 1 hr to fix

                      Method tryServerCache has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          protected function tryServerCache()
                          {
                              $this->debug(3, 'Trying server cache');
                              if (is_file($this->cachefile)) {
                                  $this->debug(3, "Cachefile {$this->cachefile} exists");
                      Severity: Minor
                      Found in thumb.php - About 1 hr to fix

                        Method mms has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function mms(&$patterns, &$replacements): void
                            {
                                $patterns[]     = "/\[mms=(['\"]?)([^\"']*),([^\"']*)\\1]([^\"]*)\[\/mms\]/sU";
                                $rp             = "<OBJECT id=videowindow1 height='\\3' width='\\2' classid='CLSID:6BF52A52-394A-11D3-B153-00C04F79FAA6'>";
                                $rp             .= '<PARAM NAME="URL" VALUE="\\4">';
                        Severity: Minor
                        Found in class/MyTextSanitizerExtension.php - About 1 hr to fix
                          Severity
                          Category
                          Status
                          Source
                          Language