railpage/railpagecore

View on GitHub

Showing 1,011 of 9,214 total issues

Method stories has 66 lines of code (exceeds 25 allowed). Consider refactoring.
Open

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

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

            public function fetch() {
                if (!is_string($this->feed)) {
                    throw new Exception("Cannot fetch news articles from RSS feed because no RSS feed was provided");
                }
                
    Severity: Major
    Found in lib/News/Scraper.php - About 2 hrs to fix

      Method getCoverImageOfObject has 65 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public static function getCoverImageOfObject($Object) {
              
              if (!self::hasCoverImage($Object)) {
                  return false;
              }
      Severity: Major
      Found in lib/Locos/Utility/CoverImageUtility.php - About 2 hrs to fix

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

            public function validate($ignore = false) {
        
                if (empty( $this->username )) {
                    throw new Exception("Username cannot be empty");
                }
        Severity: Minor
        Found in lib/Users/User.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 validatePassword has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
        Open

            public function validatePassword($password = false, $username = false) {
                
                Utility\PasswordUtility::validateParameters($password, $username, $this); 
        
                /**
        Severity: Minor
        Found in lib/Users/User.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 fetch has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
        Open

                public function fetch($id = false) {
                    if ($id) {
                        $this->id = $id;
                    }
        
        Severity: Minor
        Found in lib/News/Article.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 fetch has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
        Open

            private function fetch($recurse) {
                
                if (!filter_var($this->id, FILTER_VALIDATE_INT)) {
                    $this->id = Utility\LocomotiveUtility::getClassId($this->id); 
                }
        Severity: Minor
        Found in lib/Locos/LocoClass.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 getReadItemsForUser has a Cognitive Complexity of 19 (exceeds 5 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 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 send has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
        Open

                public function send($markAsSent = false) {
                    
                    $this->validate(); 
                    
                    $Smarty = AppCore::getSmarty(); 
        Severity: Minor
        Found in lib/Reminders/Reminder.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 makeJSON has 63 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                public function makeJSON() {
        
                    if ($this->date instanceof DateTime) {
                        $timezone = $this->date->getTimezone();
                    } else {
        Severity: Major
        Found in lib/News/Article.php - About 2 hrs to fix

          Image has 23 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class Image extends AppCore {
          
              /**
               * Max age of data before it requires refreshing
               */
          Severity: Minor
          Found in lib/Images/Image.php - About 2 hrs to fix

            Method getPhotos has 62 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function getPhotos($num = 10) {
                    $lat = $this->lat;
                    $lon = $this->lon;
                    
                    $query = "SELECT flickr_geodata.*, 3956 * 2 * ASIN(SQRT(POWER(SIN((" . $lat . " - flickr_geodata.lat) * pi() / 180 / 2), 2) + COS(" . $lat . " * pi() / 180) * COS(" . $lat . " * pi() / 180) * POWER(SIN((" . $lon . " - flickr_geodata.lon) * pi() / 180 / 2), 2))) AS distance 
            Severity: Major
            Found in lib/Place.php - About 2 hrs to fix

              File Idea.php has 270 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              <?php
              
              /**
               * Suggestions for side ideas and improvements, ala Wordpress.org/ideas
               * @since Version 3.8.7
              Severity: Minor
              Found in lib/Ideas/Idea.php - About 2 hrs to fix

                Method banUser has 61 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function banUser($userId = null, $reason = null, $expiry = "0", $adminUserId = null) {
                        
                        if (!filter_var($userId, FILTER_VALIDATE_INT)) {
                            throw new InvalidArgumentException("No user ID supplied"); 
                        }
                Severity: Major
                Found in lib/BanControl/BanControl.php - About 2 hrs to fix

                  Method latest has 61 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          public function latest($number = 5, $offset = 0) {
                              $return = false;
                              $mckey = "railpage:news.latest.count=" . $number .".offset=" . $offset;
                              $mcexp = strtotime("+5 minutes"); // Store for five minutes
                              
                  Severity: Major
                  Found in lib/News/Base.php - About 2 hrs to fix

                    Method latestPosts has 61 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function latestPosts($is_auth_ary, $since, $limit = 10) {
                            if (empty($is_auth_ary) || !is_array($is_auth_ary)) {
                                return false;
                            }
                            
                    Severity: Major
                    Found in lib/Forums/Forums.php - About 2 hrs to fix

                      Function NominateImage has a Cognitive Complexity of 18 (exceeds 5 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 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 getWeatherForecast has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function getWeatherForecast($days = 14) {
                              
                              return false;
                              
                              $weather = false;
                      Severity: Minor
                      Found in lib/Place.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 getPhotoContext has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public static function getPhotoContext(Image $imageObject, $unapprovedOnly = null) {
                              
                              $Database = (new AppCore)->getDatabaseConnection(); 
                              
                              if ($unapprovedOnly == false || $unapprovedOnly == null) {
                      Severity: Minor
                      Found in lib/Images/Utility/Finder.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 updateAuthors has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public static function updateAuthors() {
                              
                              $userlookup = array(); 
                              
                              $Database = (new AppCore)->getDatabaseConnection(); 
                      Severity: Minor
                      Found in lib/Images/Utility/Updater.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

                      Severity
                      Category
                      Status
                      Source
                      Language