railpage/railpagecore

View on GitHub

Showing 1,011 of 9,214 total issues

Method getPhotosForSite has 74 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        public function getPhotosForSite($num = 10, $start = 0) {
            
            $Place = new Place($this->lat, $this->lon); 
            
            return $Place->getPhotosFromSphinx($num); 
Severity: Major
Found in lib/Locations/Location.php - About 2 hrs to fix

    Method GenerateTimeline has 73 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function GenerateTimeline($dateFrom, $dateTo) {
            
            $page = false;
            $items_per_page = false;
            
    Severity: Major
    Found in lib/Users/Timeline.php - About 2 hrs to fix

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

          public function getImage($id, $force = 0) {
              $params = array(
                  "ImageKey" => $id
              );
              
      Severity: Minor
      Found in lib/Images/Provider/SmugMug.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

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

          public static function EmbedGoogleMap(DOMElement $e) {
              
              $timer = Debug::GetTimer(); 
              
              $Config = AppCore::GetConfig(); 
      Severity: Minor
      Found in lib/Formatting/MultimediaUtility.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

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

          public function getProviders($region = null) {
              $ritit = new RecursiveIteratorIterator(new RecursiveDirectoryIterator(__DIR__), RecursiveIteratorIterator::CHILD_FIRST); 
              $providers = array(); 
              
              foreach ($ritit as $splFileInfo) {
      Severity: Minor
      Found in lib/GTFS/GTFS.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 commit has 72 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              public function commit() {
                  
                  /**
                   * Fill in the gaps with the new Place object
                   */
      Severity: Major
      Found in lib/Locations/Location.php - About 2 hrs to fix

        Method find has 70 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public static function find() {
                
                $args       = func_get_args(); 
                $Loco       = false;
                $LocoClass  = false;
        Severity: Major
        Found in lib/Images/Utility/Finder.php - About 2 hrs to fix

          Method parse has 70 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  public function parse() {
                      if (empty($this->feeds)) {
                          throw new Exception("No scraped RSS data was found (hint: Consume::scrape())");
                      }
                      
          Severity: Major
          Found in lib/RSS/Consume.php - About 2 hrs to fix

            Method getAllForums has 70 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function getAllForums() {
                    $query = "SELECT f.*, c.*, lp.topic_id AS lastpost_topic_id, lp.poster_id AS lastpost_user_id, u.username AS lastpost_username, lp.post_time AS lastpost_time 
                                FROM nuke_bbforums AS f
                                LEFT JOIN nuke_bbposts AS lp ON lp.post_id = forum_last_post_id
                                LEFT JOIN nuke_bbcategories AS c ON c.cat_id = f.cat_id
            Severity: Major
            Found in lib/Forums/Forums.php - About 2 hrs to fix

              Method fetch has 69 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      public function fetch($id = false) {
                          if ($id) {
                              $this->id = $id;
                          }
              
              Severity: Major
              Found in lib/News/Article.php - About 2 hrs to fix

                Method getArray has 69 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        public function getArray() {
                            $array = array(
                                "id" => $this->id,
                                "subject" => $this->subject,
                                "body" => $this->body,
                Severity: Major
                Found in lib/Notifications/Notification.php - About 2 hrs to fix

                  Method __construct has 69 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function __construct() {
                          global $ZendDB, $ZendDB_ReadOnly, $PHPUnitTest;
                          
                          /**
                           * Create the registry
                  Severity: Major
                  Found in lib/AppCore.php - About 2 hrs to fix

                    Function validate has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                    Open

                        private function validate() {
                            if (empty($this->title)) {
                                throw new Exception("Competition title cannot be empty");
                            }
                            
                    Severity: Minor
                    Found in lib/Images/Competition.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

                    Function lookup has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public static function lookup($type, $id, $activeOnly) {
                            
                            $Database = (new AppCore)->getDatabaseConnection(); 
                            
                            if ($type == "ip") {
                    Severity: Minor
                    Found in lib/BanControl/LookupUtility.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

                    Function newest has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                    Open

                            public function newest($user_id = false, $fullArray = false) {
                                if ($this->db instanceof \sql_db) {
                                    if ($user_id) {
                                        // Logged in, have they dismissed this message?
                                        $query = "SELECT * FROM messages WHERE message_active = 1 AND message_id NOT IN (SELECT message_id FROM messages_viewed WHERE user_id = ".$this->db->real_escape_string($user_id).") ORDER BY message_id DESC LIMIT 1";
                    Severity: Minor
                    Found in lib/SiteMessage/SiteMessage.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

                    Function __construct has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function __construct() {
                            parent::__construct(); 
                            
                            // If memcache is enabled, check there first
                            $mckey = "railpage:forums.index";
                    Severity: Minor
                    Found in lib/Forums/Index.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 load has 68 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function load($userId = false) {
                    
                            if (filter_var($userId, FILTER_VALIDATE_INT)) {
                                $this->id = $userId;
                            }
                    Severity: Major
                    Found in lib/Users/User.php - About 2 hrs to fix

                      Method getPhotoLegacy has 68 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function getPhotoLegacy($photo_id = false) {
                              if (!$photo_id) {
                                  throw new Exception("Cannot fetch photo info and sizes - no photo ID given"); 
                                  return false;
                              }
                      Severity: Major
                      Found in lib/Railcams/Camera.php - About 2 hrs to fix

                        File Notification.php has 279 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        <?php
                            /**
                             * System notification object
                             * @since Version 3.9.1
                             * @package Railpage
                        Severity: Minor
                        Found in lib/Notifications/Notification.php - About 2 hrs to fix

                          File Forum.php has 279 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          <?php
                          
                          /**
                           * Forums API
                           * @since Version 3.0.1
                          Severity: Minor
                          Found in lib/Forums/Forum.php - About 2 hrs to fix
                            Severity
                            Category
                            Status
                            Source
                            Language