mambax7/publisher

View on GitHub

Showing 355 of 3,032 total issues

Method getLocalImagePath has 50 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function getLocalImagePath($src)
    {
        $src = ltrim($src, '/'); //strip off the leading '/'
        if (!$this->docRoot) {
            $this->debug(3, 'We have no document root set, so as a last resort, lets check if the image is in the current dir and serve that.');
Severity: Minor
Found in thumb.php - About 2 hrs to fix

    Method resizeAndCrop has 50 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function resizeAndCrop()
        {
            // check file extension
            switch ($this->imageMimetype) {
                case 'image/png':
    Severity: Minor
    Found in class/Resizer.php - About 2 hrs to fix

      Method assign has 49 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function assign(\XoopsTpl $tpl): void
          {
              $i        = -1;
              $tab      = -1;
              $elements = [];
      Severity: Minor
      Found in class/Form/ThemeTabForm.php - About 1 hr to fix

        Function publisher_items_random_item_show has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
        Open

        function publisher_items_random_item_show($options)
        {
            $block = [];
        
            $helper = Helper::getInstance();
        Severity: Minor
        Found in blocks/items_random_item.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 getKey has a Cognitive Complexity of 15 (exceeds 5 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

        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 assign has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
        Open

            public function assign(\XoopsTpl $tpl): void
            {
                $i        = -1;
                $tab      = -1;
                $elements = [];
        Severity: Minor
        Found in class/Form/ThemeTabForm.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 publisher_items_new_edit has 47 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function publisher_items_new_edit($options)
        {
            // require_once PUBLISHER_ROOT_PATH . '/class/blockform.php';
            xoops_load('XoopsFormLoader');
        
        
        Severity: Minor
        Found in blocks/items_new.php - About 1 hr to fix

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

              public static function getTitle($title = '', $withExt = true)
              {
                  /**
                   * if XOOPS ML is present, let's sanitize the title with the current language
                   */
          Severity: Minor
          Found in class/Seo.php - About 1 hr to fix

            Method orderBlock has 15 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                    array $bid,
                    array $oldtitle,
                    array $oldside,
                    array $oldweight,
                    array $oldvisible,
            Severity: Major
            Found in class/Common/Blocksadmin.php - About 1 hr to fix

              Method loadSampleData has 46 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function loadSampleData(): void
              {
                  global $xoopsConfig;
                  $moduleDirName      = \basename(\dirname(__DIR__));
                  $moduleDirNameUpper = \mb_strtoupper($moduleDirName);
              Severity: Minor
              Found in testdata/index.php - About 1 hr to fix

                Method serveWebshot has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    protected function serveWebshot()
                    {
                        $this->debug(3, 'Starting serveWebshot');
                        $instr = 'Please follow the instructions at https://code.google.com/p/timthumb/ to set your server up for taking website screenshots.';
                        if (!is_file(WEBSHOT_CUTYCAPT)) {
                Severity: Minor
                Found in thumb.php - About 1 hr to fix

                  Method getFormFeedback has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function getFormFeedback($action = false)
                      {
                          if (!$action) {
                              $action = $_SERVER['REQUEST_URI'];
                          }
                  Severity: Minor
                  Found in class/Common/ModuleFeedback.php - About 1 hr to fix

                    Method getAllFiles has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function getAllFiles($itemId = 0, $status = -1, $limit = 0, $start = 0, $sort = 'datesub', $order = 'DESC', $category = [])
                        {
                            $files = [];
                    
                            $this->table_link = $this->db->prefix($this->helper->getDirname() . '_items');
                    Severity: Minor
                    Found in class/FileHandler.php - About 1 hr to fix

                      Function AjaxUpload has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          window.AjaxUpload = function (button, options) {
                              this._settings = {
                                  // Location of the server-side upload script
                                  action: 'upload.php',
                                  // File upload name
                      Severity: Minor
                      Found in assets/js/ajaxupload.3.9.js - About 1 hr to fix

                        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 closeTags has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public static function closeTags($string)
                              {
                                  // match opened tags
                                  if (\preg_match_all('/<([a-z\:\-]+)[^\/]>/', $string, $startTags)) {
                                      $startTags = $startTags[1];
                          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 mergeImage has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public function mergeImage(): void
                              {
                                  $dest = \imagecreatefromjpeg($this->endFile);
                                  $src  = \imagecreatefromjpeg($this->sourceFile);
                                  if (4 == $this->mergeType) {
                          Severity: Minor
                          Found in class/Resizer.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 renderErrors has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public static function renderErrors($errArray, $reseturl = ''): void
                              {
                                  if ($errArray && \is_array($errArray)) {
                                      echo '<div id="readOnly" class="errorMsg" style="border:1px solid #D24D00; background:#FEFECC url(' . PUBLISHER_URL . '/assets/images/important-32.png) no-repeat 7px 50%;color:#333;padding-left:45px;">';
                          
                          
                          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 getImages has a Cognitive Complexity of 14 (exceeds 5 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

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

                              public static function checkVerModule(\Xmf\Module\Helper $helper, ?string $source = 'github', ?string $default = 'master'): ?array
                              {
                                  /*
                                          // Generated by curl-to-PHP: https://incarnate.github.io/curl-to-php/
                                          $ch = curl_init();
                          Severity: Minor
                          Found in class/Common/VersionChecks.php - About 1 hr to fix
                            Severity
                            Category
                            Status
                            Source
                            Language