XoopsModules25x/smallworld

View on GitHub

Showing 759 of 1,838 total issues

Avoid too many return statements within this method.
Open

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

    Avoid too many return statements within this method.
    Open

            return true;
    Severity: Major
    Found in class/Common/Resizer.php - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

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

        Avoid too many return statements within this method.
        Open

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

          Avoid too many return statements within this method.
          Open

                      return $modOptions[$repmodule][$option];
          Severity: Major
          Found in include/functions.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

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

              Avoid too many return statements within this method.
              Open

                      return $success;
              Severity: Major
              Found in class/UploadHandler.php - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

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

                  Avoid too many return statements within this method.
                  Open

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

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

                    function smallworld_array_flatten($array, $preserve_keys = 1, &$newArray = [])
                    {
                        foreach ($array as $key => $child) {
                            if (is_array($child)) {
                                $newArray = smallworld_array_flatten($child, $preserve_keys, $newArray);
                    Severity: Minor
                    Found in include/functions.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 smallworld_Gravatar has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                    function smallworld_Gravatar($uid)
                    {
                        $depMsg = __FUNCTION__ . " is deprecated use SwUserHandler::gravatar() instead.";
                        if (isset($GLOBALS['xoopsLogger'])) {
                            $GLOBALS['xoopsLogger']->addDeprecated($depMsg);
                    Severity: Minor
                    Found in include/functions.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 smallworld_tolink has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                    function smallworld_tolink($text, $uid)
                    {
                        $helper = Helper::getInstance();
                        $ext        = mb_substr($text, -4, 4);
                        $ext2       = mb_substr($text, -5, 5);
                    Severity: Minor
                    Found in include/functions.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 smallworld_getTagUsers has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                    function smallworld_getTagUsers($txt, $sender, $permalink = '')
                    {
                        $dBase = new Smallworld\SwDatabase();
                        $mail  = new Smallworld\Mail();
                        preg_match_all('/@([a-zA-Z0-9]+|\\[[a-zA-Z0-9]+\\])/', $txt, $matches);
                    Severity: Minor
                    Found in include/functions.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 Gravatar has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function Gravatar($uid)
                        {
                            $depMsg = get_class() . __FUNCTION__ . " is deprecated use SwUserHandler::gravatar() instead.";
                            if (isset($GLOBALS['xoopsLogger'])) {
                                $GLOBALS['xoopsLogger']->addDeprecated($depMsg);
                    Severity: Minor
                    Found in class/WallUpdates.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 post has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function post($print_response = true)
                        {
                            if (isset($_REQUEST['_method']) && 'DELETE' === $_REQUEST['_method']) {
                                return $this->delete($print_response);
                            }
                    Severity: Minor
                    Found in class/UploadHandler.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 getAvatarLink has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function getAvatarLink($userId, $image)
                        {
                            $swUser = $this->getByUserId($userId);
                            $gender = (false !== $swUser) ? $swUser->getVar('gender') : Constants::GENDER_UNKNOWN;
                            $link   = (preg_match('/avatars/i', $image)) ? XOOPS_UPLOAD_URL . '/' . $image : $image;
                    Severity: Minor
                    Found in class/SwUserHandler.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 convertIPAddresses has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                        private function convertIPAddresses($tableName, $columnName)
                        {
                            if ($this->tableHandler->useTable($tableName)) {
                                $attributes = $this->tableHandler->getColumnAttributes($tableName, $columnName);
                                if (false !== mb_strpos($attributes, ' int(')) {
                    Severity: Minor
                    Found in class/Common/Migrate.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 Gravatar has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function Gravatar($uid)
                        {
                            $depMsg = get_class() . __FUNCTION__ . " is deprecated use SwUserHandler::gravatar() instead.";
                            if (isset($GLOBALS['xoopsLogger'])) {
                                $GLOBALS['xoopsLogger']->addDeprecated($depMsg);
                    Severity: Minor
                    Found in class/PublicWallUpdates.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 following_or has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function following_or($userId, $friendId)
                        {
                            $respons = [0 => 0]; // init the array
                            if ($userId != $friendId) {
                                $sql    = 'SELECT * FROM ' . $GLOBALS['xoopsDB']->prefix('smallworld_followers') . " WHERE me = '" . (int)$userId . "' AND you = '" . (int)$friendId . "'";
                    Severity: Minor
                    Found in class/User.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

                    Severity
                    Category
                    Status
                    Source
                    Language