mambax7/publisher

View on GitHub
class/Utility.php

Summary

Maintainability
F
1 wk
Test Coverage

editFile accesses the super-global variable $GLOBALS.
Open

    public static function editFile($showmenu = false, $fileid = 0, $itemId = 0)
    {
        $helper = Helper::getInstance();
        require_once $GLOBALS['xoops']->path('class/xoopsformloader.php');

Severity: Minor
Found in class/Utility.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

userIsAuthor accesses the super-global variable $GLOBALS.
Open

    public static function userIsAuthor($itemObj)
    {
        return (\is_object($GLOBALS['xoopsUser']) && \is_object($itemObj) && ($GLOBALS['xoopsUser']->uid() == $itemObj->uid()));
    }
Severity: Minor
Found in class/Utility.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

ratingBar accesses the super-global variable $GLOBALS.
Open

    public static function ratingBar($itemId)
    {
        $helper          = Helper::getInstance();
        $ratingUnitWidth = 30;
        $units           = 5;
Severity: Minor
Found in class/Utility.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

uploadFile accesses the super-global variable $_FILES.
Open

    public static function uploadFile($another, $withRedirect, &$itemObj=null)
    {
        \xoops_load('XoopsMediaUploader');
        //        require_once PUBLISHER_ROOT_PATH . '/class/uploader.php';

Severity: Minor
Found in class/Utility.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

ratingBar accesses the super-global variable $GLOBALS.
Open

    public static function ratingBar($itemId)
    {
        $helper          = Helper::getInstance();
        $ratingUnitWidth = 30;
        $units           = 5;
Severity: Minor
Found in class/Utility.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

ratingBar accesses the super-global variable $GLOBALS.
Open

    public static function ratingBar($itemId)
    {
        $helper          = Helper::getInstance();
        $ratingUnitWidth = 30;
        $units           = 5;
Severity: Minor
Found in class/Utility.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

uploadFile accesses the super-global variable $GLOBALS.
Open

    public static function uploadFile($another, $withRedirect, &$itemObj=null)
    {
        \xoops_load('XoopsMediaUploader');
        //        require_once PUBLISHER_ROOT_PATH . '/class/uploader.php';

Severity: Minor
Found in class/Utility.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

ratingBar accesses the super-global variable $GLOBALS.
Open

    public static function ratingBar($itemId)
    {
        $helper          = Helper::getInstance();
        $ratingUnitWidth = 30;
        $units           = 5;
Severity: Minor
Found in class/Utility.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

userIsAdmin accesses the super-global variable $GLOBALS.
Open

    public static function userIsAdmin()
    {
        $helper = Helper::getInstance();

        static $publisherIsAdmin;
Severity: Minor
Found in class/Utility.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

userIsAuthor accesses the super-global variable $GLOBALS.
Open

    public static function userIsAuthor($itemObj)
    {
        return (\is_object($GLOBALS['xoopsUser']) && \is_object($itemObj) && ($GLOBALS['xoopsUser']->uid() == $itemObj->uid()));
    }
Severity: Minor
Found in class/Utility.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

uploadFile accesses the super-global variable $GLOBALS.
Open

    public static function uploadFile($another, $withRedirect, &$itemObj=null)
    {
        \xoops_load('XoopsMediaUploader');
        //        require_once PUBLISHER_ROOT_PATH . '/class/uploader.php';

Severity: Minor
Found in class/Utility.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 Utility.php has 896 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

declare(strict_types=1);

namespace XoopsModules\Publisher;
Severity: Major
Found in class/Utility.php - About 2 days to fix

    Utility has 46 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Utility extends Common\SysUtility
    {
        //--------------- Custom module methods -----------------------------
        /**
         * Function responsible for checking if a directory exists, we can also write in and create an index.html file
    Severity: Minor
    Found in class/Utility.php - About 6 hrs to fix

      Method editCategory has 99 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public static function editCategory($showmenu = false, $categoryid = 0, $nbSubCats = 4, $categoryObj = null)
          {
              $helper = Helper::getInstance();
              $configurator = new Common\Configurator();
              $icons = $configurator->icons;
      Severity: Major
      Found in class/Utility.php - About 3 hrs to fix

        The class Utility has 36 non-getter- and setter-methods. Consider refactoring Utility to keep number of methods under 25.
        Open

        class Utility extends Common\SysUtility
        {
            //--------------- Custom module methods -----------------------------
            /**
             * Function responsible for checking if a directory exists, we can also write in and create an index.html file
        Severity: Minor
        Found in class/Utility.php by phpmd

        TooManyMethods

        Since: 0.1

        A class with too many methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

        By default it ignores methods starting with 'get' or 'set'.

        The default was changed from 10 to 25 in PHPMD 2.3.

        Example

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

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

        class Utility extends Common\SysUtility
        {
            //--------------- Custom module methods -----------------------------
            /**
             * Function responsible for checking if a directory exists, we can also write in and create an index.html file
        Severity: Minor
        Found in class/Utility.php by phpmd

        The class Utility has 36 public methods. Consider refactoring Utility to keep number of public methods under 10.
        Open

        class Utility extends Common\SysUtility
        {
            //--------------- Custom module methods -----------------------------
            /**
             * Function responsible for checking if a directory exists, we can also write in and create an index.html file
        Severity: Minor
        Found in class/Utility.php by phpmd

        TooManyPublicMethods

        Since: 0.1

        A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

        By default it ignores methods starting with 'get' or 'set'.

        Example

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

        Function editCategory has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
        Open

            public static function editCategory($showmenu = false, $categoryid = 0, $nbSubCats = 4, $categoryObj = null)
            {
                $helper = Helper::getInstance();
                $configurator = new Common\Configurator();
                $icons = $configurator->icons;
        Severity: Minor
        Found in class/Utility.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 ratingBar has 59 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public static function ratingBar($itemId)
            {
                $helper          = Helper::getInstance();
                $ratingUnitWidth = 30;
                $units           = 5;
        Severity: Major
        Found in class/Utility.php - About 2 hrs to fix

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

              public static function uploadFile($another, $withRedirect, &$itemObj=null)
              {
                  \xoops_load('XoopsMediaUploader');
                  //        require_once PUBLISHER_ROOT_PATH . '/class/uploader.php';
          
          
          Severity: Minor
          Found in class/Utility.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 uploadFile has 50 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public static function uploadFile($another, $withRedirect, &$itemObj=null)
              {
                  \xoops_load('XoopsMediaUploader');
                  //        require_once PUBLISHER_ROOT_PATH . '/class/uploader.php';
          
          
          Severity: Minor
          Found in class/Utility.php - About 2 hrs 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 renderErrors has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
            Open

                public static function renderErrors($errArray, $reseturl = '')
                {
                    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

            Method createDir has 40 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public static function createDir()
                {
                    // auto crate folders
                    //        $thePath = static::getUploadDir();
            
            
            Severity: Minor
            Found in class/Utility.php - About 1 hr to fix

              Method displayCategory has 40 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public static function displayCategory(Category $categoryObj, $level = 0)
                  {
                      $helper = Helper::getInstance();
                      $configurator = new Common\Configurator();
                      $icons = $configurator->icons;
              Severity: Minor
              Found in class/Utility.php - About 1 hr to fix

                Method html2text has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public static function html2text($document)
                    {
                        // PHP Manual:: function preg_replace
                        // $document should contain an HTML document.
                        // This will remove HTML tags, javascript sections
                Severity: Minor
                Found in class/Utility.php - About 1 hr to fix

                  Function copyr has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public static function copyr($source, $dest)
                      {
                          // Simple copy for a file
                          if (\is_file($source)) {
                              return \copy($source, $dest);
                  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()
                      {
                          // 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 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

                  The class Utility has 46 public methods and attributes. Consider reducing the number of public items to less than 45.
                  Open

                  class Utility extends Common\SysUtility
                  {
                      //--------------- Custom module methods -----------------------------
                      /**
                       * Function responsible for checking if a directory exists, we can also write in and create an index.html file
                  Severity: Minor
                  Found in class/Utility.php by phpmd

                  ExcessivePublicCount

                  Since: 0.1

                  A large number of public methods and attributes declared in a class can indicate the class may need to be broken up as increased effort will be required to thoroughly test it.

                  Example

                  public class Foo {
                      public $value;
                      public $something;
                      public $var;
                      // [... more more public attributes ...]
                  
                      public function doWork() {}
                      public function doMoreWork() {}
                      public function doWorkAgain() {}
                      // [... more more public methods ...]
                  }

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

                  Function mkdir has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public static function mkdir($target)
                      {
                          // http://www.php.net/manual/en/function.mkdir.php
                          // saint at corenova.com
                          // bart at cdasites dot com
                  Severity: Minor
                  Found in class/Utility.php - About 45 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 recurseCopy has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public static function recurseCopy($src, $dst)
                      {
                          $dir = \opendir($src);
                          //    @mkdir($dst);
                          while (false !== ($file = \readdir($dir))) {
                  Severity: Minor
                  Found in class/Utility.php - About 45 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

                  Method createCategorySelect has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      public static function createCategorySelect($selectedId = 0, $parentcategory = 0, $allCatOption = true, $selectname = 'options[1]', $multiple = true)
                  Severity: Minor
                  Found in class/Utility.php - About 35 mins to fix

                    Method openCollapsableBar has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        public static function openCollapsableBar($tablename = '', $iconname = '', $tabletitle = '', $tabledsc = '', $open = true)
                    Severity: Minor
                    Found in class/Utility.php - About 35 mins to fix

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

                          public static function getEditors($allowedEditors = null)
                          {
                              $ret    = [];
                              $nohtml = false;
                              \xoops_load('XoopsEditorHandler');
                      Severity: Minor
                      Found in class/Utility.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 addCategoryOption has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public static function addCategoryOption(Category $categoryObj, $selectedId = 0, $level = 0, $ret = '')
                          {
                              $helper = Helper::getInstance();
                      
                              $spaces = '';
                      Severity: Minor
                      Found in class/Utility.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 createCategorySelect has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public static function createCategorySelect($selectedId = 0, $parentcategory = 0, $allCatOption = true, $selectname = 'options[1]', $multiple = true)
                          {
                              $helper = Helper::getInstance();
                      
                              $selectedId  = \explode(',', $selectedId);
                      Severity: Minor
                      Found in class/Utility.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 displayCategory has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public static function displayCategory(Category $categoryObj, $level = 0)
                          {
                              $helper = Helper::getInstance();
                              $configurator = new Common\Configurator();
                              $icons = $configurator->icons;
                      Severity: Minor
                      Found in class/Utility.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

                      Avoid too many return statements within this method.
                      Open

                              return null;
                      Severity: Major
                      Found in class/Utility.php - About 30 mins to fix

                        Avoid too many return statements within this method.
                        Open

                                    return 'DESC';
                        Severity: Major
                        Found in class/Utility.php - About 30 mins to fix

                          Avoid too many return statements within this method.
                          Open

                                      return 'DESC';
                          Severity: Major
                          Found in class/Utility.php - About 30 mins to fix

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

                                public static function editFile($showmenu = false, $fileid = 0, $itemId = 0)
                                {
                                    $helper = Helper::getInstance();
                                    require_once $GLOBALS['xoops']->path('class/xoopsformloader.php');
                            
                            
                            Severity: Minor
                            Found in class/Utility.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

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

                                public static function getPathStatus($item, $getStatus = false)
                                {
                                    $path = '';
                                    if ('root' !== $item) {
                                        $path = $item;
                            Severity: Minor
                            Found in class/Utility.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

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

                                public static function getOrderBy($sort)
                                {
                                    if ('datesub' === $sort) {
                                        return 'DESC';
                                    }
                            Severity: Minor
                            Found in class/Utility.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 class Utility has 1430 lines of code. Current threshold is 1000. Avoid really long classes.
                            Open

                            class Utility extends Common\SysUtility
                            {
                                //--------------- Custom module methods -----------------------------
                                /**
                                 * Function responsible for checking if a directory exists, we can also write in and create an index.html file
                            Severity: Minor
                            Found in class/Utility.php by phpmd

                            The method createDir() has an NPath complexity of 1125. The configured NPath complexity threshold is 200.
                            Open

                                public static function createDir()
                                {
                                    // auto crate folders
                                    //        $thePath = static::getUploadDir();
                            
                            
                            Severity: Minor
                            Found in class/Utility.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 editCategory() has 119 lines of code. Current threshold is set to 100. Avoid really long methods.
                            Open

                                public static function editCategory($showmenu = false, $categoryid = 0, $nbSubCats = 4, $categoryObj = null)
                                {
                                    $helper = Helper::getInstance();
                                    $configurator = new Common\Configurator();
                                    $icons = $configurator->icons;
                            Severity: Minor
                            Found in class/Utility.php by phpmd

                            The method uploadFile() has an NPath complexity of 360. The configured NPath complexity threshold is 200.
                            Open

                                public static function uploadFile($another, $withRedirect, &$itemObj=null)
                                {
                                    \xoops_load('XoopsMediaUploader');
                                    //        require_once PUBLISHER_ROOT_PATH . '/class/uploader.php';
                            
                            
                            Severity: Minor
                            Found in class/Utility.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 ratingBar() has an NPath complexity of 960. The configured NPath complexity threshold is 200.
                            Open

                                public static function ratingBar($itemId)
                                {
                                    $helper          = Helper::getInstance();
                                    $ratingUnitWidth = 30;
                                    $units           = 5;
                            Severity: Minor
                            Found in class/Utility.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 createDir() has a Cyclomatic Complexity of 14. The configured cyclomatic complexity threshold is 10.
                            Open

                                public static function createDir()
                                {
                                    // auto crate folders
                                    //        $thePath = static::getUploadDir();
                            
                            
                            Severity: Minor
                            Found in class/Utility.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 editCategory() has a Cyclomatic Complexity of 11. The configured cyclomatic complexity threshold is 10.
                            Open

                                public static function editCategory($showmenu = false, $categoryid = 0, $nbSubCats = 4, $categoryObj = null)
                                {
                                    $helper = Helper::getInstance();
                                    $configurator = new Common\Configurator();
                                    $icons = $configurator->icons;
                            Severity: Minor
                            Found in class/Utility.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 copyr() has a Cyclomatic Complexity of 10. The configured cyclomatic complexity threshold is 10.
                            Open

                                public static function copyr($source, $dest)
                                {
                                    // Simple copy for a file
                                    if (\is_file($source)) {
                                        return \copy($source, $dest);
                            Severity: Minor
                            Found in class/Utility.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 uploadFile() has a Cyclomatic Complexity of 13. The configured cyclomatic complexity threshold is 10.
                            Open

                                public static function uploadFile($another, $withRedirect, &$itemObj=null)
                                {
                                    \xoops_load('XoopsMediaUploader');
                                    //        require_once PUBLISHER_ROOT_PATH . '/class/uploader.php';
                            
                            
                            Severity: Minor
                            Found in class/Utility.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 ratingBar() has a Cyclomatic Complexity of 13. The configured cyclomatic complexity threshold is 10.
                            Open

                                public static function ratingBar($itemId)
                                {
                                    $helper          = Helper::getInstance();
                                    $ratingUnitWidth = 30;
                                    $units           = 5;
                            Severity: Minor
                            Found in class/Utility.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

                            Avoid using undefined variables such as '$key' which will lead to PHP notices.
                            Open

                                        unset($key);
                            Severity: Minor
                            Found in class/Utility.php by phpmd

                            UndefinedVariable

                            Since: 2.8.0

                            Detects when a variable is used that has not been defined before.

                            Example

                            class Foo
                            {
                                private function bar()
                                {
                                    // $message is undefined
                                    echo $message;
                                }
                            }

                            Source https://phpmd.org/rules/cleancode.html#undefinedvariable

                            The method editFile has a boolean flag argument $showmenu, which is a certain sign of a Single Responsibility Principle violation.
                            Open

                                public static function editFile($showmenu = false, $fileid = 0, $itemId = 0)
                            Severity: Minor
                            Found in class/Utility.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 '44', column '31').
                            Open

                                                throw new \RuntimeException(\sprintf('Unable to create the %s directory', $folder));
                            Severity: Minor
                            Found in class/Utility.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 editCategory has a boolean flag argument $showmenu, which is a certain sign of a Single Responsibility Principle violation.
                            Open

                                public static function editCategory($showmenu = false, $categoryid = 0, $nbSubCats = 4, $categoryObj = null)
                            Severity: Minor
                            Found in class/Utility.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 getPathStatus has a boolean flag argument $getStatus, which is a certain sign of a Single Responsibility Principle violation.
                            Open

                                public static function getPathStatus($item, $getStatus = false)
                            Severity: Minor
                            Found in class/Utility.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 createCategoryOptions has a boolean flag argument $allCatOption, which is a certain sign of a Single Responsibility Principle violation.
                            Open

                                public static function createCategoryOptions($selectedId = 0, $parentcategory = 0, $allCatOption = true)
                            Severity: Minor
                            Found in class/Utility.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

                            Remove error control operator '@' on line 1415.
                            Open

                                public static function convertCharset($item)
                                {
                                    if (_CHARSET !== 'windows-1256') {
                                        return \utf8_encode($item);
                                    }
                            Severity: Minor
                            Found in class/Utility.php by phpmd

                            ErrorControlOperator

                            Error suppression should be avoided if possible as it doesn't just suppress the error, that you are trying to stop, but will also suppress errors that you didn't predict would ever occur. Consider changing error_reporting() level and/or setting up your own error handler.

                            Example

                            function foo($filePath) {
                                $file = @fopen($filPath); // hides exceptions
                                $key = @$array[$notExistingKey]; // assigns null to $key
                            }

                            Source http://phpmd.org/rules/cleancode.html#errorcontroloperator

                            Remove error control operator '@' on line 1422.
                            Open

                                public static function convertCharset($item)
                                {
                                    if (_CHARSET !== 'windows-1256') {
                                        return \utf8_encode($item);
                                    }
                            Severity: Minor
                            Found in class/Utility.php by phpmd

                            ErrorControlOperator

                            Error suppression should be avoided if possible as it doesn't just suppress the error, that you are trying to stop, but will also suppress errors that you didn't predict would ever occur. Consider changing error_reporting() level and/or setting up your own error handler.

                            Example

                            function foo($filePath) {
                                $file = @fopen($filPath); // hides exceptions
                                $key = @$array[$notExistingKey]; // assigns null to $key
                            }

                            Source http://phpmd.org/rules/cleancode.html#errorcontroloperator

                            Missing class import via use statement (line '581', column '23').
                            Open

                                        throw new \RuntimeException(\sprintf('Directory "%s" was not created', $dest));
                            Severity: Minor
                            Found in class/Utility.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

                            Remove error control operator '@' on line 680.
                            Open

                                public static function chmod($target, $mode = 0777)
                                {
                                    return @\chmod($target, $mode);
                                }
                            Severity: Minor
                            Found in class/Utility.php by phpmd

                            ErrorControlOperator

                            Error suppression should be avoided if possible as it doesn't just suppress the error, that you are trying to stop, but will also suppress errors that you didn't predict would ever occur. Consider changing error_reporting() level and/or setting up your own error handler.

                            Example

                            function foo($filePath) {
                                $file = @fopen($filPath); // hides exceptions
                                $key = @$array[$notExistingKey]; // assigns null to $key
                            }

                            Source http://phpmd.org/rules/cleancode.html#errorcontroloperator

                            Missing class import via use statement (line '1169', column '31').
                            Open

                                                throw new \RuntimeException(\_CO_PUBLISHER_FILEUPLOAD_ERROR . static::formatErrors($fileObj->getErrors()));
                            Severity: Minor
                            Found in class/Utility.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 '1285', column '27').
                            Open

                                    $criteria   = new \Criteria('itemid', $itemId);
                            Severity: Minor
                            Found in class/Utility.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 openCollapsableBar has a boolean flag argument $open, which is a certain sign of a Single Responsibility Principle violation.
                            Open

                                public static function openCollapsableBar($tablename = '', $iconname = '', $tabletitle = '', $tabledsc = '', $open = true)
                            Severity: Minor
                            Found in class/Utility.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 createCategorySelect has a boolean flag argument $multiple, which is a certain sign of a Single Responsibility Principle violation.
                            Open

                                public static function createCategorySelect($selectedId = 0, $parentcategory = 0, $allCatOption = true, $selectname = 'options[1]', $multiple = true)
                            Severity: Minor
                            Found in class/Utility.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 makeUri has a boolean flag argument $encodeAmp, which is a certain sign of a Single Responsibility Principle violation.
                            Open

                                public static function makeUri($page, $vars = [], $encodeAmp = true)
                            Severity: Minor
                            Found in class/Utility.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 truncateTagSafe has a boolean flag argument $breakWords, which is a certain sign of a Single Responsibility Principle violation.
                            Open

                                public static function truncateTagSafe($string, $length = 80, $etc = '...', $breakWords = false)
                            Severity: Minor
                            Found in class/Utility.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 createCategorySelect has a boolean flag argument $allCatOption, which is a certain sign of a Single Responsibility Principle violation.
                            Open

                                public static function createCategorySelect($selectedId = 0, $parentcategory = 0, $allCatOption = true, $selectname = 'options[1]', $multiple = true)
                            Severity: Minor
                            Found in class/Utility.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 getUploadDir has a boolean flag argument $hasPath, which is a certain sign of a Single Responsibility Principle violation.
                            Open

                                public static function getUploadDir($hasPath = true, $item = '')
                            Severity: Minor
                            Found in class/Utility.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 getImageDir has a boolean flag argument $hasPath, which is a certain sign of a Single Responsibility Principle violation.
                            Open

                                public static function getImageDir($item = '', $hasPath = true)
                            Severity: Minor
                            Found in class/Utility.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 '389', column '28').
                            Open

                                        $pagenav = new \XoopsPageNav($totalitems, $helper->getConfig('idxcat_perpage'), $startitem, 'startitem', $pagenavExtraArgs);
                            Severity: Minor
                            Found in class/Utility.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 moduleHome has a boolean flag argument $withLink, which is a certain sign of a Single Responsibility Principle violation.
                            Open

                                public static function moduleHome($withLink = true)
                            Severity: Minor
                            Found in class/Utility.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

                            Remove error control operator '@' on line 627.
                            Open

                                public static function getPathStatus($item, $getStatus = false)
                                {
                                    $path = '';
                                    if ('root' !== $item) {
                                        $path = $item;
                            Severity: Minor
                            Found in class/Utility.php by phpmd

                            ErrorControlOperator

                            Error suppression should be avoided if possible as it doesn't just suppress the error, that you are trying to stop, but will also suppress errors that you didn't predict would ever occur. Consider changing error_reporting() level and/or setting up your own error handler.

                            Example

                            function foo($filePath) {
                                $file = @fopen($filPath); // hides exceptions
                                $key = @$array[$notExistingKey]; // assigns null to $key
                            }

                            Source http://phpmd.org/rules/cleancode.html#errorcontroloperator

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

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

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

                                    $helper = Helper::getInstance();
                            Severity: Minor
                            Found in class/Utility.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 recurseCopy uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                            Open

                                            } else {
                                                \copy($src . '/' . $file, $dst . '/' . $file);
                                            }
                            Severity: Minor
                            Found in class/Utility.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 editCategory uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                            Open

                                        } else {
                                            echo '<tr>';
                                            echo "<td class='head' align='center' colspan= '7'>" . \_AM_PUBLISHER_NOSUBCAT . '</td>';
                                            echo '</tr>';
                                        }
                            Severity: Minor
                            Found in class/Utility.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 editFile uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                            Open

                                    } else {
                                        // there's no parameter, so we're adding an item
                                        $fileObj = $helper->getHandler('File')->create();
                                        $fileObj->setVar('itemid', $itemId);
                                        echo "<span style='color: #2F5376; font-weight: bold; font-size: 16px; margin: 6px 6px 0 0; '>" . \_AM_PUBLISHER_FILE_ADDING . '</span>';
                            Severity: Minor
                            Found in class/Utility.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 '\Xmf\Request' in method 'editCategory'.
                            Open

                                        $startitem = Request::getInt('startitem');
                            Severity: Minor
                            Found in class/Utility.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 editCategory uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                            Open

                                    } else {
                                        static::openCollapsableBar('createtable', 'createtableicon', \_AM_PUBLISHER_CATEGORY_CREATE, \_AM_PUBLISHER_CATEGORY_CREATE_INFO);
                                    }
                            Severity: Minor
                            Found in class/Utility.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\Helper' in method 'editFile'.
                            Open

                                    $helper = Helper::getInstance();
                            Severity: Minor
                            Found in class/Utility.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 editCategory uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                            Open

                                    } else {
                                        static::closeCollapsableBar('createtable', 'createtableicon');
                                    }
                            Severity: Minor
                            Found in class/Utility.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 editFile uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                            Open

                                    } else {
                                        static::closeCollapsableBar('addfile', 'addfileicon');
                                    }
                            Severity: Minor
                            Found in class/Utility.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 '\Xmf\Request' in method 'getCurrentUrls'.
                            Open

                                    $phpself     = Request::getString('SCRIPT_NAME', '', 'SERVER');
                            Severity: Minor
                            Found in class/Utility.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

                            Avoid using static access to class '\Xmf\Request' in method 'uploadFile'.
                            Open

                                    $itemId  = Request::getInt('itemid', 0, 'POST');
                            Severity: Minor
                            Found in class/Utility.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 closeTags uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                            Open

                                        } else {
                                            $completeTags = $startTags;
                                        }
                            Severity: Minor
                            Found in class/Utility.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 getPathStatus uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                            Open

                                    } else {
                                        $pathCheckResult = -1;
                                        $pathStatus      = \_AM_PUBLISHER_NOTAVAILABLE . " <a href='" . PUBLISHER_ADMIN_URL . "/index.php?op=createdir&amp;path={$item}'>" . \_AM_PUBLISHER_CREATETHEDIR . '</a>';
                                    }
                            Severity: Minor
                            Found in class/Utility.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 getEditors uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                            Open

                                        } else {
                                            //for admin permissions page
                                            $ret[$key]['name']  = $name;
                                            $ret[$key]['title'] = $title;
                                        }
                            Severity: Minor
                            Found in class/Utility.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 '\Xmf\Request' in method 'tellAFriend'.
                            Open

                                    $targetUri = XOOPS_URL . Request::getString('REQUEST_URI', '', 'SERVER');
                            Severity: Minor
                            Found in class/Utility.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

                            Avoid using static access to class 'XoopsModules\Publisher\Session' in method 'uploadFile'.
                            Open

                                    $session = Session::getInstance();
                            Severity: Minor
                            Found in class/Utility.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 closeTags uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                            Open

                                                } else {
                                                    $completeTags[] = $val;
                                                }
                            Severity: Minor
                            Found in class/Utility.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 '\Xmf\Request' in method 'getCookieVar'.
                            Open

                                    return Request::getString($name, $default, 'COOKIE');
                            Severity: Minor
                            Found in class/Utility.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

                            Avoid using static access to class '\Xmf\Request' in method 'uploadFile'.
                            Open

                                    $session->set('publisher_file_status', Request::getInt('item_file_status', 1, 'POST'));
                            Severity: Minor
                            Found in class/Utility.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

                            Avoid using static access to class '\XoopsEditorHandler' in method 'getEditors'.
                            Open

                                    $editorHandler = \XoopsEditorHandler::getInstance();
                            Severity: Minor
                            Found in class/Utility.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

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

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

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

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

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

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

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

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

                            Avoid using static access to class '\Xmf\Request' in method 'uploadFile'.
                            Open

                                    $fileObj->setVar('name', Request::getString('item_file_name', '', 'POST'));
                            Severity: Minor
                            Found in class/Utility.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

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

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

                            Avoid assigning values to variables in if clauses and the like (line '1413', column '24').
                            Open

                                public static function convertCharset($item)
                                {
                                    if (_CHARSET !== 'windows-1256') {
                                        return \utf8_encode($item);
                                    }
                            Severity: Minor
                            Found in class/Utility.php by phpmd

                            IfStatementAssignment

                            Since: 2.7.0

                            Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.

                            Example

                            class Foo
                            {
                                public function bar($flag)
                                {
                                    if ($foo = 'bar') { // possible typo
                                        // ...
                                    }
                                    if ($baz = 0) { // always false
                                        // ...
                                    }
                                }
                            }

                            Source http://phpmd.org/rules/cleancode.html#ifstatementassignment

                            Avoid using static access to class '\Xmf\Request' in method 'editCategory'.
                            Open

                                        $parentid         = Request::getInt('parentid', 0, 'GET');
                            Severity: Minor
                            Found in class/Utility.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

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

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

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

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

                            Avoid using static access to class '\Xmf\Request' in method 'uploadFile'.
                            Open

                                    $session->set('publisher_file_description', Request::getString('item_file_description', '', 'POST'));
                            Severity: Minor
                            Found in class/Utility.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

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

                                    $helper          = Helper::getInstance();
                            Severity: Minor
                            Found in class/Utility.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 getUploadDir uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                            Open

                                        } else {
                                            $item .= '/';
                                        }
                            Severity: Minor
                            Found in class/Utility.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 '\Xmf\Request' in method 'getCurrentUrls'.
                            Open

                                    $httphost    = Request::getString('HTTP_HOST', '', 'SERVER');
                            Severity: Minor
                            Found in class/Utility.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 renderErrors uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                            Open

                                            } else {
                                                echo '<li><a href="#' . $key . '" onclick="var e = xoopsGetElementById(\'' . $key . '\'); e.focus();">' . \htmlspecialchars($error, \ENT_QUOTES | \ENT_HTML5) . '</a></li>';
                                            }
                            Severity: Minor
                            Found in class/Utility.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 '\Xmf\Request' in method 'uploadFile'.
                            Open

                                    $fileObj->setVar('description', Request::getString('item_file_description', '', 'POST'));
                            Severity: Minor
                            Found in class/Utility.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 copyr uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                            Open

                                        } else {
                                            \copy("$source/$entry", "$dest/$entry");
                                        }
                            Severity: Minor
                            Found in class/Utility.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 assigning values to variables in if clauses and the like (line '1150', column '18').
                            Open

                                public static function uploadFile($another, $withRedirect, &$itemObj=null)
                                {
                                    \xoops_load('XoopsMediaUploader');
                                    //        require_once PUBLISHER_ROOT_PATH . '/class/uploader.php';
                            
                            
                            Severity: Minor
                            Found in class/Utility.php by phpmd

                            IfStatementAssignment

                            Since: 2.7.0

                            Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.

                            Example

                            class Foo
                            {
                                public function bar($flag)
                                {
                                    if ($foo = 'bar') { // possible typo
                                        // ...
                                    }
                                    if ($baz = 0) { // always false
                                        // ...
                                    }
                                }
                            }

                            Source http://phpmd.org/rules/cleancode.html#ifstatementassignment

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

                                        } else {
                                            $itemId = -1;
                                            echo '<tr>';
                                            echo "<td class='head' align='center' colspan= '7'>" . \_AM_PUBLISHER_NOITEMS . '</td>';
                                            echo '</tr>';
                            Severity: Minor
                            Found in class/Utility.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 userIsAdmin uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                            Open

                                    } else {
                                        $publisherIsAdmin = false;
                                    }
                            Severity: Minor
                            Found in class/Utility.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\Helper' in method 'addCategoryOption'.
                            Open

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

                            Avoid using static access to class '\Xmf\Request' in method 'uploadFile'.
                            Open

                                    $session->set('publisher_file_filename', Request::getString('item_file_name', '', 'POST'));
                            Severity: Minor
                            Found in class/Utility.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 uploadFile uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                            Open

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

                                    } else {
                                        $item = 'images';
                                    }
                            Severity: Minor
                            Found in class/Utility.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 '\Xmf\Request' in method 'getCurrentUrls'.
                            Open

                                    $querystring = Request::getString('QUERY_STRING', '', 'SERVER');
                            Severity: Minor
                            Found in class/Utility.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

                            Avoid using static access to class '\Xmf\Request' in method 'uploadFile'.
                            Open

                                    $fileObj->setVar('status', Request::getInt('item_file_status', 1, 'POST'));
                            Severity: Minor
                            Found in class/Utility.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 uploadFile uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                            Open

                                            } else {
                                                return $message;
                                            }
                            Severity: Minor
                            Found in class/Utility.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 local variables such as '$key'.
                            Open

                                        unset($key);
                            Severity: Minor
                            Found in class/Utility.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 '$showmenu'.
                            Open

                                public static function editFile($showmenu = false, $fileid = 0, $itemId = 0)
                            Severity: Minor
                            Found in class/Utility.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 '$msg'.
                            Open

                                        $msg     = $res ? \_AM_PUBLISHER_DIRCREATED : \_AM_PUBLISHER_DIRNOTCREATED;
                            Severity: Minor
                            Found in class/Utility.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 '$totalSCOnPage'.
                            Open

                                        $totalSCOnPage = \count($subcatsObj);
                            Severity: Minor
                            Found in class/Utility.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 '$showmenu'.
                            Open

                                public static function editCategory($showmenu = false, $categoryid = 0, $nbSubCats = 4, $categoryObj = null)
                            Severity: Minor
                            Found in class/Utility.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 '$itemId'.
                            Open

                                            $itemId = -1;
                            Severity: Minor
                            Found in class/Utility.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 '$catId'.
                            Open

                                        foreach ($categoriesObj as $catId => $categoryObj) {
                            Severity: Minor
                            Found in class/Utility.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 '$ret'.
                            Open

                                        if (!$ret = $fileObj->checkUpload('item_upload_file', $allowedMimetypes, $errors)) {
                            Severity: Minor
                            Found in class/Utility.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 '$catId'.
                            Open

                                        foreach ($categoriesObj as $catId => $categoryObj) {
                            Severity: Minor
                            Found in class/Utility.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 '$key'.
                            Open

                                    foreach ($errors as $key => $value) {
                            Severity: Minor
                            Found in class/Utility.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 '$catId'.
                            Open

                                        foreach ($subCategoriesObj as $catId => $subCategoryObj) {
                            Severity: Minor
                            Found in class/Utility.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 '$key'.
                            Open

                                            foreach ($startTags as $key => $val) {
                            Severity: Minor
                            Found in class/Utility.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

                            TODO found
                            Open

                                //TODO rename this function? And exclude image folder?
                            Severity: Minor
                            Found in class/Utility.php by fixme

                            TODO found
                            Open

                                    // TODO : display the available mimetypes to the user
                            Severity: Minor
                            Found in class/Utility.php by fixme

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

                                    while (false !== ($file = \readdir($dir))) {
                                        if (('.' !== $file) && ('..' !== $file)) {
                                            if (\is_dir($src . '/' . $file)) {
                                                self::recurseCopy($src . '/' . $file, $dst . '/' . $file);
                                            } else {
                            Severity: Major
                            Found in class/Utility.php and 1 other location - About 1 hr to fix
                            class/Common/FilesManagement.php on lines 66..74

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

                            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

                                    if (static::getPathStatus('images/category', true) < 0) {
                                        $thePath = static::getImageDir('category');
                                        $res     = static::mkdir($thePath);
                            
                                        if ($res) {
                            Severity: Major
                            Found in class/Utility.php and 1 other location - About 1 hr to fix
                            class/Utility.php on lines 130..140

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

                            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

                                    if (static::getPathStatus('images/item', true) < 0) {
                                        $thePath = static::getImageDir('item');
                                        $res     = static::mkdir($thePath);
                            
                                        if ($res) {
                            Severity: Major
                            Found in class/Utility.php and 1 other location - About 1 hr to fix
                            class/Utility.php on lines 118..128

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

                            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

                                    try {
                                        if (!\is_dir($folder)) {
                                            if (!\is_dir($folder) && !\mkdir($folder) && !\is_dir($folder)) {
                                                throw new \RuntimeException(\sprintf('Unable to create the %s directory', $folder));
                                            }
                            Severity: Minor
                            Found in class/Utility.php and 1 other location - About 35 mins to fix
                            class/Common/FilesManagement.php on lines 33..43

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

                            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

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

                                    $ip            = \getenv('REMOTE_ADDR');
                            Severity: Minor
                            Found in class/Utility.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 $qs. Configured minimum length is 3.
                            Open

                                    $qs = '';
                            Severity: Minor
                            Found in class/Utility.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

                            Incorrect spacing between argument "$itemObj" and equals sign; expected 1 but found 0
                            Open

                                public static function uploadFile($another, $withRedirect, &$itemObj=null)
                            Severity: Minor
                            Found in class/Utility.php by phpcodesniffer

                            Incorrect spacing between default value and equals sign for argument "$itemObj"; expected 1 but found 0
                            Open

                                public static function uploadFile($another, $withRedirect, &$itemObj=null)
                            Severity: Minor
                            Found in class/Utility.php by phpcodesniffer

                            Opening brace should be on a new line
                            Open

                                public static function iconSourceTag($path, $image, $alt){
                            Severity: Minor
                            Found in class/Utility.php by phpcodesniffer

                            Line indented incorrectly; expected 8 spaces, found 12
                            Open

                                        static function ($matches) {
                            Severity: Minor
                            Found in class/Utility.php by phpcodesniffer

                            Line indented incorrectly; expected 8 spaces, found 12
                            Open

                                        },
                            Severity: Minor
                            Found in class/Utility.php by phpcodesniffer

                            There are no issues that match your filters.

                            Category
                            Status