railpage/railpagecore

View on GitHub

Showing 1,011 of 9,214 total issues

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

        public function commit() {
            
            $this->validate();
            
            $data = array(
Severity: Minor
Found in lib/Notifications/Notification.php - About 1 hr to fix

    Method validate has 40 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function validate() {
            
            if (is_null($this->bbcode_uid)) {
                $this->bbcode_uid = "sausages";
            }
    Severity: Minor
    Found in lib/Forums/Post.php - About 1 hr to fix

      Method activeForums has 40 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function activeForums($num_forums = 1, $age) {
              if (empty($age)) {
                  $age = strtotime("30 days ago"); 
              }
              
      Severity: Minor
      Found in lib/Forums/Stats.php - About 1 hr to fix

        Function load has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

            public function load($userId = false) {
        
                if (filter_var($userId, FILTER_VALIDATE_INT)) {
                    $this->id = $userId;
                }
        Severity: Minor
        Found in lib/Users/User.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 tryAutoLogin has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

            public function tryAutoLogin() {
        
                if (is_null(filter_input(INPUT_COOKIE, "rp_autologin"))) { #empty($_COOKIE['rp_autologin'])) {
                    $this->addNote("Autologin attempted but no autologin cookie was found");
        
        Severity: Minor
        Found in lib/Users/User.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 updateHash has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

            public function updateHash() {
        
                $cookie = is_null(filter_input(INPUT_COOKIE, "rp_userhash")) ? "" : filter_input(INPUT_COOKIE, "rp_userhash"); # isset($_COOKIE['rp_userhash']) ? $_COOKIE['rp_userhash'] : "";
                $hash = array();
                $update = false;
        Severity: Minor
        Found in lib/Users/User.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 createSlug has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

            public function createSlug($categoryId = false) {
                if (RP_DEBUG) {
                    global $site_debug;
                    $debug_timer_start = microtime(true);
                }
        Severity: Minor
        Found in lib/Links/Links.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 cacheGeoData has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

            private function cacheGeoData() {
        
                if (!$this->Place instanceof Place) {
                    return $this;
                }
        Severity: Minor
        Found in lib/Images/Image.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 CreateImage has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

            public static function CreateImage($id = null, $provider = null, $options = null) {
                
                $Redis = AppCore::GetRedis(); 
                $Registry = Registry::GetInstance(); 
                    
        Severity: Minor
        Found in lib/Images/ImageFactory.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 mostReadThisWeek has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

                public function mostReadThisWeek($limit = 5) {
                    $return = false;
                    
                    $params = array(); 
                    
        Severity: Minor
        Found in lib/News/Base.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 createSlug has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

                public function createSlug($story_id = false) {
                    if (RP_DEBUG) {
                        global $site_debug;
                        $debug_timer_start = microtime(true);
                    }
        Severity: Minor
        Found in lib/News/Base.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 getArray has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

                public function getArray() {
                    $array = array(
                        "id" => $this->id,
                        "subject" => $this->subject,
                        "body" => $this->body,
        Severity: Minor
        Found in lib/Notifications/Notification.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 13 (exceeds 5 allowed). Consider refactoring.
        Open

            public function __construct($id = null) {
                
                parent::__construct();
                
                $this->Module = new Module("Gallery");
        Severity: Minor
        Found in lib/Gallery/Album.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 activeThreads has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

            public function activeThreads($num_threads = 1, $age) {
                if (empty($age)) {
                    $age = strtotime("30 days ago"); 
                }
                
        Severity: Minor
        Found in lib/Forums/Stats.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 activeForums has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

            public function activeForums($num_forums = 1, $age) {
                if (empty($age)) {
                    $age = strtotime("30 days ago"); 
                }
                
        Severity: Minor
        Found in lib/Forums/Stats.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

        Method getWatchedThreads has 39 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function getWatchedThreads($page = 1, $limit = null) {
        
                // Assume Zend_Db
        
                if (!filter_var($limit, FILTER_VALIDATE_INT)) {
        Severity: Minor
        Found in lib/Users/User.php - About 1 hr to fix

          Method suggestLiveries has 39 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function suggestLiveries() {
          
                  $query = '
                      SELECT livery.livery_id AS id, livery.livery AS name, livery.photo_id
                      FROM loco_livery AS livery
          Severity: Minor
          Found in lib/Images/Image.php - About 1 hr to fix

            Method getContents has 39 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    public function getContents($page = 1, $items_per_page = 25) {
                        if (empty($this->folder)) {
                            throw new Exception("Cannot get folder contents - no folder specified"); 
                        } 
                        
            Severity: Minor
            Found in lib/PrivateMessages/Folder.php - About 1 hr to fix

              Method getTrains has 39 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      public function getTrains($from = false, $to = false) {
                          if (!$from) {
                              $from = new DateTime;
                          } 
                          
              Severity: Minor
              Found in lib/Timetables/Point.php - About 1 hr to fix

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

                    public function getPhotos($items_per_page = 25, $page_num = 1, $date_from = false, $date_to = false) {
                        if (!empty($this->flickr_oauth_secret) && !empty($this->flickr_oauth_token)) {
                            // Fetch photos using OAuth
                            $f = new flickr_railpage(RP_FLICKR_API_KEY);
                            $f->oauth_token     = $this->flickr_oauth_token;
                Severity: Minor
                Found in lib/Railcams/Camera.php - About 1 hr to fix
                  Severity
                  Category
                  Status
                  Source
                  Language