railpage/railpagecore

View on GitHub

Showing 1,011 of 9,214 total issues

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

    public function getLatestPostRatings($limit = 10) {
        $query = "SELECT r.*, u.username, t.topic_title, f.forum_name, p.poster_id
                    FROM nuke_bbposts_reputation AS r 
                        LEFT JOIN nuke_users AS u ON r.user_id = u.user_id 
                        LEFT JOIN nuke_bbposts AS p ON r.post_id = p.post_id
Severity: Minor
Found in lib/Forums/Forums.php - About 1 hr to fix

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

        public function getCategories($parent = 0, $children = true) {
            $parent = intval($parent);
            
            $mckey = "railpage:links.categories.parent=" . $parent . ".children=" . (bool)$children; 
            
    Severity: Minor
    Found in lib/Links/Links.php - About 1 hr to fix

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

          public function NominateImage(Image $imageObject, DateTime $dateWeek, User $userObject) {
              
              $query = "SELECT id FROM image_weekly WHERE datefrom = ?";
              
              if ($this->db->fetchOne($query, $dateWeek->format("Y-m-d"))) {
      Severity: Minor
      Found in lib/Images/PhotoOfTheWeek.php - About 1 hr to fix

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

                public function findArticles($offset = 0, $limit = 25, $orderby = "story_time_unix") {
                    
                    if (empty($this->filter_topics) || empty($this->filter_words)) {
                        $this->getFilters();
                    }
        Severity: Minor
        Found in lib/News/Feed.php - About 1 hr to fix

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

                  public static function setPushSubscription(User $User, $subscription, $enabled = null) {
                      
                      $endpoint = false;
                      $registration_id = false;
                      $provider = false;
          Severity: Minor
          Found in lib/Notifications/Notifications.php - About 1 hr to fix

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

                public function getAddress() {
                    
                    $mckey = sprintf("railpage.place.address.lat=%s&lon=%s", $this->lat, $this->lon);
                    
                    if ($address = $this->Memcached->fetch($mckey)) {
            Severity: Minor
            Found in lib/Place.php - About 1 hr to fix

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

                  private function getExifIDs($exif) {
                      
                      $required = [ 
                          "camera_make", 
                          "camera_model",
              Severity: Minor
              Found in lib/Images/Exif.php - About 1 hr to fix

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

                    private function populate() {
                        
                        $this->mckey = sprintf("railpage:gallery.album.image=%d", $this->id);
                        
                        if (!$row = $this->Memcached->fetch($this->mckey)) {
                Severity: Minor
                Found in lib/Gallery/Image.php - About 1 hr to fix

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

                      function __construct($threadid = false) {
                          
                          if (RP_DEBUG) {
                              global $site_debug;
                              $debug_timer_start = microtime(true);
                  Severity: Minor
                  Found in lib/Forums/Thread.php - About 1 hr to fix

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

                            public function send() {
                                
                                $Client = new Client;
                                
                                $failures = array();
                    Severity: Minor
                    Found in lib/Notifications/Transport/Push.php - About 1 hr to fix

                      Method getReadTopics has 45 lines of code (exceeds 25 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 1 hr to fix

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

                                public function __construct($code) {
                        
                                    parent::__construct();
                        
                                    $this->code = $code;
                        Severity: Minor
                        Found in lib/Locations/Country.php - About 1 hr to fix

                          Method generateCalendar has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public function generateCalendar() {
                                  
                                  /**
                                   * Load the Events class for later on
                                   */
                          Severity: Minor
                          Found in lib/Events/Month.php - About 1 hr to fix

                            Method load has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                public function load($id = false, $getParent = false) {
                                    if ($id === false) {
                                        throw new InvalidArgumentException("No valid forum ID or shortname was provided");
                                    }
                                    
                            Severity: Minor
                            Found in lib/Forums/Forum.php - About 1 hr to fix

                              Method getReadItemsForUser has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  public static function getReadItemsForUser(User $User, $type = "t") {
                                      
                                      /**
                                       * Not logged in - no threads/forums
                                       */
                              Severity: Minor
                              Found in lib/Forums/Forums.php - About 1 hr to fix

                                Function CreateLocation has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                                Open

                                        public function CreateLocation($id) {
                                            
                                            $Memcached = AppCore::getMemcached(); 
                                            $Redis = AppCore::getRedis(); 
                                            $Registry = Registry::getInstance(); 
                                Severity: Minor
                                Found in lib/Locations/Factory.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 __construct has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    public function __construct() {
                                        
                                        foreach (EmoticonsUtility::getEmoticons() as $key => $emoticons) {
                                            
                                            if (count($emoticons) === 1) {
                                Severity: Minor
                                Found in lib/Formatting/EmoticonsRuleset.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 CreateLocoClass has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    public static function CreateLocoClass($id = false) {
                                
                                        $Redis = AppCore::getRedis();
                                        $Registry = Registry::getInstance();
                                
                                Severity: Minor
                                Found in lib/Locos/Factory.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 getDescriptionBits_Dates has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    public static function getDescriptionBits_Dates(Locomotive $Loco, $bits) {
                                
                                        $dates = $Loco->loadDates();
                                        $dates = array_reverse($dates);
                                
                                
                                Severity: Minor
                                Found in lib/Locos/Utility/LocomotiveUtility.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 __construct has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    public function __construct($id = NULL) {
                                
                                        $timer = Debug::getTimer();
                                
                                        parent::__construct();
                                Severity: Minor
                                Found in lib/Locos/Manufacturer.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

                                Severity
                                Category
                                Status
                                Source
                                Language