railpage/railpagecore

View on GitHub

Showing 708 of 9,214 total issues

Method makePermalink has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        public function makePermalink($id = false) {
            $mckey = $id ? "railpage:locations.permalink.id=" . $id : "railpage:locations.permalink.id=" . $this->id;
            
            $timer = Debug::GetTimer(); 
            
Severity: Minor
Found in lib/Locations/Locations.php - About 1 hr to fix

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

            public function getArray() {
                
                $array = array(
                    "id" => $this->id,
                    "lat" => $this->lat,
    Severity: Minor
    Found in lib/Sightings/Sighting.php - About 1 hr to fix

      Method getPending has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              public function getPending() {
                  
                  #$query = "SELECT s.*, t.topicname, t.topicimage, t.topictext, u.username FROM nuke_stories AS s, nuke_topics AS t, nuke_users AS u WHERE s.user_id = u.user_id AND s.topic = t.topicid";
                  $query = "SELECT s.*, t.topicname, t.topictext, u.username, 'newqueue' AS queue
                      FROM nuke_stories AS s
      Severity: Minor
      Found in lib/News/Base.php - About 1 hr to fix

        Method CreateLocation has 26 lines of code (exceeds 25 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

          Method setRating has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function setRating($userId = false, $rating = false) {
                  if (!$userId instanceof User && !filter_var($userId, FILTER_VALIDATE_INT)) {
                      throw new Exception("Cannot set user rating for this loco - no user given"); 
                  }
                  
          Severity: Minor
          Found in lib/Locos/Locomotive.php - About 1 hr to fix

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

                function commit() {
                    $this->validate(); 
                    
                    $data = array(
                        "forum_id" => $this->forum->id,
            Severity: Minor
            Found in lib/Forums/Thread.php - About 1 hr to fix

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

                  private function populate($id) {
                      
                      $row = $this->load($id); 
                      
                      if (!isset($row) || !is_array($row)) {
              Severity: Minor
              Found in lib/Events/Event.php - About 1 hr to fix

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

                    public function fetch() {
                        if (!filter_var($this->id, FILTER_VALIDATE_INT)) {
                            throw new Exception("Cannot load loco object - loco ID not provided");
                            return false;
                        }
                Severity: Minor
                Found in lib/Locos/Locomotive.php - About 1 hr to fix

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

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

                    Method CreateEvent has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public static function CreateEvent($id = null) {
                            
                            $CacheDriver = AppCore::getRedis(); 
                            $Registry = Registry::getInstance(); 
                            
                    Severity: Minor
                    Found in lib/Events/Factory.php - About 1 hr to fix

                      Method reloadOrganisations has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          private function reloadOrganisations($type) {
                              
                              if (substr($type, -1) !== "s") {
                                  $type .= "s";
                              }
                      Severity: Minor
                      Found in lib/Locos/Locomotive.php - About 1 hr to fix

                        Method getCenterFromDegrees has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public static function getCenterFromDegrees($data) {
                                if (!is_array($data)) return FALSE;
                            
                                $num_coords = count($data);
                            
                        Severity: Minor
                        Found in lib/PlaceUtility.php - About 1 hr to fix

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

                              public function send($action= "message",  $data = null, $address = "socket.io/?EIO=2", $transport = 'websocket') {
                                  
                                  $fd = fsockopen($this->hostname, $this->port, $errno, $errstr);
                                  
                                  if (!$fd) {
                          Severity: Minor
                          Found in lib/SocketIO.php - About 1 hr to fix

                            Function makePermaLink has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                            Open

                                public function makePermaLink($entity = false) {
                                    if (!$entity) {
                                        return false;
                                    }
                                    
                            Severity: Minor
                            Found in lib/Links/Links.php - About 55 mins 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 onlineUsers has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                            Open

                                public function onlineUsers() {
                                    $mckey = "railpage:onlineusers"; 
                                    
                                    if ($return = $this->Memcached->fetch($mckey)) {
                                        foreach ($return as $id => $row) {
                            Severity: Minor
                            Found in lib/Users/Base.php - About 55 mins 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 findWithAttribute has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                            Open

                                public function findWithAttribute($attribute = null, $value = null) {
                                    
                                    if ($attribute == null) {
                                        throw new Exception("Cannot filter groups by attribute - no attribute given!"); 
                                    }
                            Severity: Minor
                            Found in lib/Users/Groups.php - About 55 mins 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 generateTitle has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                            Open

                                public static function generateTitle($row) {
                                    
                                    self::$row = $row;
                                    
                                    switch (self::$row['key']) {
                            Severity: Minor
                            Found in lib/Users/Timeline/Utility/ObjectTitle.php - About 55 mins 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 canUserVote has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                            Open

                                public function canUserVote(User $userObject, $imageObject = null) {
                                    if (!filter_var($userObject->id, FILTER_VALIDATE_INT)) {
                                        return false;
                                    }
                                    
                            Severity: Minor
                            Found in lib/Images/Competition.php - About 55 mins 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 banUser has a Cognitive Complexity of 9 (exceeds 5 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: Minor
                            Found in lib/BanControl/BanControl.php - About 55 mins 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 addTiming has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                            Open

                                    public function addTiming($day = false, $time = false, $going = "arr", $commencing = false, $expiring = false) {
                                        if (!$this->Point instanceof Point) {
                                            throw new Exception("Cannot add a timing because no valid timetable point has been set");
                                        }
                                        
                            Severity: Minor
                            Found in lib/Timetables/Train.php - About 55 mins 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