railpage/railpagecore

View on GitHub

Showing 1,011 of 9,214 total issues

Function purge has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    public function purge() {
        // Purge pending accounts older than 24 hours
        $age = strtotime("-2 weeks"); 
        
        $query = "SELECT u.username, u.user_id, u.user_regdate, u.user_actkey 
Severity: Minor
Found in lib/Users/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 notifyWinner has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    public static function notifyWinner(Competition $compObject) {
            
        if (isset($compObject->meta['winnernotified']) && $compObject->meta['winnernotified'] === true) {
            return $this;
        }
Severity: Minor
Found in lib/Images/Utility/CompNotify.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 setCommodity has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

        public function setCommodity($commodity) {
            switch (strtolower($commodity)) {
                case "intermodal" :
                    $this->commodity = self::COMMODITY_INTERMODAL;
                    break;
Severity: Minor
Found in lib/Timetables/Train.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 12 (exceeds 5 allowed). Consider refactoring.
Open

        public function __construct($id = false) {
            parent::__construct(); 
            
            if (is_string($id)) {
                $query = "SELECT id FROM timetable_points WHERE name = ? OR slug = ?"; 
Severity: Minor
Found in lib/Timetables/Point.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 PrintPretty has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    public static function PrintPretty() {

        // temporary
        global $site_debug;
Severity: Minor
Found in lib/Debug.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 validate has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    public function validate() {
        if (is_null($this->object_id)) {
            $this->object_id = "";
        }
        
Severity: Minor
Found in lib/PrivateMessages/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

Function __construct has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    public function __construct($module) {

        parent::__construct();

        if (!is_string($module)) {
Severity: Minor
Found in lib/Module.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 createSummary has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

        private function createSummary($str, $n = 1024, $end_char = '…') {
            
            $str = strip_tags($str, "<ul><li><ol>");
            
            $str = explode("\n", $str); 
Severity: Minor
Found in lib/RSS/Consume.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 generateCalendar has a Cognitive Complexity of 12 (exceeds 5 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

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 CreateLocomotive has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    public static function CreateLocomotive($id = false, $class = false, $number = 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 validate has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    public function validate() {

        if (is_null($this->Loco) && filter_var($this->id, FILTER_VALIDATE_INT)) {
            $this->loadLoco();
        }
Severity: Minor
Found in lib/Locos/Date.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 setReminderDate has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

        public function setReminderDate(DateTime $Reminder, DateTime $EventDate) {
            
            $Now = new DateTime;
            
            if ($EventDate <= $Now) {
Severity: Minor
Found in lib/Reminders/Reminder.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 commit has 35 lines of code (exceeds 25 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

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

      Method getHTML5Video has 35 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function getHTML5Video() {
              if (empty($this->mime) && file_exists(RP_DOWNLOAD_DIR . $this->filepath)) {
                  $this->getThumbnail(); 
              }
              
      Severity: Minor
      Found in lib/Downloads/Download.php - About 1 hr to fix

        Method autoPopulateNextComp has 35 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function autoPopulateNextComp() {
                $month = new DateTime("first day of next month"); 
                
                $title = $month->format("F Y");
                
        Severity: Minor
        Found in lib/Images/Competitions.php - About 1 hr to fix

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

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

            Method StopsNearLocation has 35 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function StopsNearLocation($latitude = null, $longitude = null) {
                    if ($latitude == null) {
                        throw new Exception("Cannot fetch " . __METHOD__ . " - no latitude given");
                    }
                    
            Severity: Minor
            Found in lib/GTFS/StandardProvider.php - About 1 hr to fix

              Method formatDepartures has 35 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function formatDepartures($departures) {
                      $return = array();
                      
                      if (isset($departures['values'])) {
                          foreach ($departures['values'] as $row) {
              Severity: Minor
              Found in lib/GTFS/AU/VIC/PTV/Stop.php - About 1 hr to fix

                Method addReputationMarker has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function addReputationMarker($reputation_type_id = false) {
                        if (!filter_var($reputation_type_id, FILTER_VALIDATE_INT)) {
                            throw new Exception("Cannot add a reputation marker to this post because the supplied type ID (\$reputation_type_id) is not valid");
                        }
                        
                Severity: Minor
                Found in lib/Forums/Post.php - About 1 hr to fix
                  Severity
                  Category
                  Status
                  Source
                  Language