railpage/railpagecore

View on GitHub

Showing 708 of 9,214 total issues

Function format has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
Open

    public static function format($userAvatar = null, $width = 100, $height = 100) {
        if (is_null($userAvatar)) {
            return false;
        }
        
Severity: Minor
Found in lib/Users/Utility/AvatarUtility.php - About 6 hrs to fix

Cognitive Complexity

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

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

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

Further reading

File Camera.php has 423 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

/**
 * Railcam object
 * @since Version 3.4
Severity: Minor
Found in lib/Railcams/Camera.php - About 6 hrs to fix

    File Place.php has 419 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    
    /**
     * Where on Earth is this place?
     * Geolookup
    Severity: Minor
    Found in lib/Place.php - About 6 hrs to fix

      File Location.php has 417 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
          /**
           * Locations module 
           * @since Version 3.0
           * @package Railpage
      Severity: Minor
      Found in lib/Locations/Location.php - About 6 hrs to fix

        Locomotive has 43 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class Locomotive extends Locos {
            
            /**
             * Registry cache key
             * @since Version 3.9.1
        Severity: Minor
        Found in lib/Locos/Locomotive.php - About 5 hrs to fix

          File Post.php has 405 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          <?php
          
          /**
           * Forums API
           * @since Version 3.0.1
          Severity: Minor
          Found in lib/Forums/Post.php - About 5 hrs to fix

            File BanControl.php has 404 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            <?php
            
            /**
             * Ban controller
             * @since Version 3.2
            Severity: Minor
            Found in lib/BanControl/BanControl.php - About 5 hrs to fix

              File AppCore.php has 396 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              <?php
              
              /**
               * Railpage AppCore
               * @since Version 3.7
              Severity: Minor
              Found in lib/AppCore.php - About 5 hrs to fix

                Function stories has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
                Open

                        public function stories($page = false, $limit = false) {
                            #if ($page == false || $limit == false) {
                            #   return false;
                            #}
                            
                Severity: Minor
                Found in lib/News/Archive.php - About 5 hrs to fix

                Cognitive Complexity

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

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

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

                Further reading

                Function getReadTopics has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function getReadTopics($user_id = false) {
                        global $Error;
                        
                        if (!$user_id) {
                            return false;
                Severity: Minor
                Found in lib/Forums/Forums.php - About 4 hrs to fix

                Cognitive Complexity

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

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

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

                Further reading

                File Download.php has 369 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                <?php
                
                /** 
                 * Downloads 
                 * @since Version 3.0
                Severity: Minor
                Found in lib/Downloads/Download.php - About 4 hrs to fix

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

                      public static function createOtherSizes() {
                          
                          $sleep = 2; 
                          $sleep = false;
                          
                  Severity: Minor
                  Found in lib/Gallery/Utility/CreateSizes.php - About 4 hrs to fix

                  Cognitive Complexity

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

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

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

                  Further reading

                  Function generate has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function generate() {
                          $string = '';
                          
                          global $handheld;
                          
                  Severity: Minor
                  Found in lib/PageControls.php - About 4 hrs to fix

                  Cognitive Complexity

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

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

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

                  Further reading

                  Function process has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
                  Open

                          private function process(array $item) {
                              
                              /**
                               * Process the description field
                               */
                  Severity: Minor
                  Found in lib/RSS/Consume.php - About 4 hrs to fix

                  Cognitive Complexity

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

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

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

                  Further reading

                  Function makeQuery has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
                  Open

                      private static function makeQuery() {
                          
                          $basequery = "SELECT SQL_CALC_FOUND_ROWS image.*, g.country_code, g.country_name, g.region_code, 
                                  g.region_name, g.neighbourhood, g.timezone, X(g.point) AS geoplace_lat, Y(g.point) AS geoplace_lon
                              FROM image
                  Severity: Minor
                  Found in lib/Images/Utility/Finder.php - About 4 hrs to fix

                  Cognitive Complexity

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

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

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

                  Further reading

                  Function deleteObjects has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
                  Open

                          public function deleteObjects($object_id = false) {
                              if (!$object_id) {
                                  //throw new Exception("Cannot delete objects - no object ID given"); 
                                  return false;
                              } 
                  Severity: Minor
                  Found in lib/PrivateMessages/PrivateMessages.php - About 4 hrs to fix

                  Cognitive Complexity

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

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

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

                  Further reading

                  Method commit has 102 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function commit() {
                          if (empty($this->bbcode_uid)) {
                              $this->bbcode_uid = crc32($this->text);
                          }
                          
                  Severity: Major
                  Found in lib/Forums/Post.php - About 4 hrs to fix

                    File Thread.php has 336 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    <?php
                    
                    /**
                     * Forums API
                     * @since Version 3.0.1
                    Severity: Minor
                    Found in lib/Forums/Thread.php - About 4 hrs to fix

                      Method createOtherSizes has 100 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public static function createOtherSizes() {
                              
                              $sleep = 2; 
                              $sleep = false;
                              
                      Severity: Major
                      Found in lib/Gallery/Utility/CreateSizes.php - About 4 hrs to fix

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

                            public function render() {
                                
                                if (!$this->userObject instanceof User) {
                                    throw new InvalidArgumentException("No valid user object has been provided"); 
                                }
                        Severity: Major
                        Found in lib/Prerender/Home.php - About 3 hrs to fix
                          Severity
                          Category
                          Status
                          Source
                          Language