railpage/railpagecore

View on GitHub

Showing 708 of 9,214 total issues

Method CreateCamera has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static function CreateCamera($id) {
        
        $Database = AppCore::GetDatabase(); 
        $Memcached = AppCore::GetMemcached(); 
        $Redis = AppCore::getRedis();
Severity: Minor
Found in lib/Images/ImageFactory.php - About 1 hr to fix

    Method CreateImageProvider has 28 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public static function CreateImageProvider($provider, $options = []) {
            
            $Config = AppCore::GetConfig(); 
            
            $imageprovider = __NAMESPACE__ . "\\Provider\\" . ucfirst($provider);
    Severity: Minor
    Found in lib/Images/Utility/ImageUtility.php - About 1 hr to fix

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

          private function validate() {
      
              if (!$this->Recipient instanceof User) {
                  throw new Exception("Cannot validate warning level adjustment - no or invalid recipient provided");
              }
      Severity: Minor
      Found in lib/Warnings/Warning.php - About 1 hr to fix

        Method getStoriesFromTopic has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                public function getStoriesFromTopic($id = false, $page = 0, $limit = 25, $total = true) {
                    if (!$id || !$this->db) {
                        return false;
                    }
                    
        Severity: Minor
        Found in lib/News/News.php - About 1 hr to fix

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

              private function validate() {
                  if (empty($this->name)) {
                      throw new Exception("Entry name cannot be empty");
                  }
                  
          Severity: Minor
          Found in lib/Glossary/Entry.php - About 1 hr to fix

            Method set has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function set($key = null, $value, $name) {
                    
                    if ($key == null) {
                        throw new Exception("Cannot set config option - \$key not given"); 
                    }
            Severity: Minor
            Found in lib/Config/Base.php - About 1 hr to fix

              Method unread has 28 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      public function unread() {
                          if ($this->db instanceof \sql_db) {
                              $query = "SELECT DISTINCT privmsgs_id 
                                          FROM nuke_bbprivmsgs 
                                          WHERE privmsgs_to_userid = ".$this->db->real_escape_string($this->User->id)." 
              Severity: Minor
              Found in lib/PrivateMessages/User.php - About 1 hr to fix

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

                        public function fetch() {
                            if (!filter_var($this->id, FILTER_VALIDATE_INT)) {
                                throw new Exception("Cannot fetch sighting - no ID given"); 
                            }
                            
                Severity: Minor
                Found in lib/Sightings/Sighting.php - About 1 hr to fix

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

                      function validate() {
                          if (empty($this->title)) {
                              throw new Exception("Thread title cannot be empty");
                          }
                          
                  Severity: Minor
                  Found in lib/Forums/Thread.php - About 1 hr to fix

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

                        private function validate() {
                            
                            if (!filter_var($this->catid, FILTER_VALIDATE_INT) && !$this->category instanceof Category) {
                                throw new Exception("No valid forum category has been set (hint: Forum::setCategory");
                            }
                    Severity: Minor
                    Found in lib/Forums/Forum.php - About 1 hr to fix

                      Method setConfig has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function setConfig($config = null) {
                              
                              if ($this->type == "LocalFS") {
                                  if (substr($config['storageRoot'], -1) != "/") {
                                      $config['storageRoot'] .= "/"; 
                      Severity: Minor
                      Found in lib/Railcams/Storage.php - About 1 hr to fix

                        Function formatExif has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function formatExif($exif) {
                                
                                $format = array();
                                
                                // Aperture
                        Severity: Minor
                        Found in lib/Images/Exif.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 populate has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                        Open

                            private function populate() {
                                $query = "SELECT organisation_id, conversions, job_added, reference_id, job_urls, job_location_id, job_classification_id, job_thread_id, job_title, job_description, job_expiry, DATEDIFF(job_expiry, NOW()) AS job_expiry_until, job_salary, job_special_cond, job_duration FROM jn_jobs WHERE job_id = ?";
                                
                                if (!$result = $this->Memcached->fetch($this->mckey)) {         
                                    $result = $this->db->fetchRow($query, $this->id);
                        Severity: Minor
                        Found in lib/Jobs/Job.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 commit has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function commit() {
                                $this->validate(); 
                                
                                /**
                                 * Firstly, check if this reference ID exists anywhere in the database. If it does, update, not create.
                        Severity: Minor
                        Found in lib/Jobs/Job.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 removeUserFavourite has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function removeUserFavourite() {
                                
                                /**
                                 * Because I'll no doubt get confused - frequently - at the order of parameters, 
                                 * let's just be a sneaky bastard and check each parameter
                        Severity: Minor
                        Found in lib/Images/Favourites.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 getTiedPhotos has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public static function getTiedPhotos(Competition $photoComp) {
                                
                                $photos = $photoComp->getPhotosAsArrayByVotes(); 
                                $votes = false;
                                $tied = [];
                        Severity: Minor
                        Found in lib/Images/Utility/CompetitionUtility.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 EmbedFlickrPhoto has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public static function EmbedFlickrPhoto(DOMElement $e) {
                                
                                if (!(preg_match("@:\/\/flic.kr/p/([a-zA-Z0-9]+)@", pq($e)->attr("href"), $matches)) && 
                                    !preg_match("@:\/\/www.flickr.com\/photos\/([a-zA-Z0-9\@]+)\/([0-9]+)@", pq($e)->attr("href"), $matches)) {
                                        return $e; 
                        Severity: Minor
                        Found in lib/Formatting/MultimediaUtility.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 getStoriesFromTopic has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                        Open

                                public function getStoriesFromTopic($id = false, $page = 0, $limit = 25, $total = true) {
                                    if (!$id || !$this->db) {
                                        return false;
                                    }
                                    
                        Severity: Minor
                        Found in lib/News/News.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 guessTopic has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                        Open

                                static public function guessTopic($topic) {
                                    
                                    /**
                                     * Normalise the topic name
                                     */
                        Severity: Minor
                        Found in lib/News/News.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 get has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                        Open

                                public function get($id = false) {
                                    if (!$id) {
                                        return false;
                                    }
                                    
                        Severity: Minor
                        Found in lib/SiteMessage/Message.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