railpage/railpagecore

View on GitHub

Showing 1,011 of 9,214 total issues

The class Forum has an overall complexity of 50 which is very high. The configured complexity threshold is 50.
Open

class Forum extends Forums {
    
    /**
     * Forum status: unlocked
     * @since Version 3.9.1
Severity: Minor
Found in lib/Forums/Forum.php by phpmd

The class Locos has an overall complexity of 104 which is very high. The configured complexity threshold is 50.
Open

class Locos extends AppCore {
    
    /**
     * Status : Operational
     * @since Version 3.8.7
Severity: Minor
Found in lib/Locos/Locos.php by phpmd

The class PlaceUtility has an overall complexity of 52 which is very high. The configured complexity threshold is 50.
Open

class PlaceUtility {
    
    /**
     * Get WoE data for a latitude/longitude lookup
     * @since Version 3.9.1
Severity: Minor
Found in lib/PlaceUtility.php by phpmd

The class Camera has an overall complexity of 79 which is very high. The configured complexity threshold is 50.
Open

class Camera extends Railcams {
    
    /**
     * Camera ID
     * @since Version 3.4
Severity: Minor
Found in lib/Railcams/Camera.php by phpmd

File Flickr.php has 304 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

/**
 * Flickr image provider for Images
 * @since Version 3.9
Severity: Minor
Found in lib/Images/Provider/Flickr.php - About 3 hrs to fix

    Function getCategories has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
    Open

        public function getCategories($parent = 0, $children = true) {
            $parent = intval($parent);
            
            $mckey = "railpage:links.categories.parent=" . $parent . ".children=" . (bool)$children; 
            
    Severity: Minor
    Found in lib/Links/Links.php - About 3 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 GenerateTimeline has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
    Open

        public function GenerateTimeline($dateFrom, $dateTo) {
            
            $page = false;
            $items_per_page = false;
            
    Severity: Minor
    Found in lib/Users/Timeline.php - About 3 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 resolveTemplate has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
    Open

        public function resolveTemplate($template) {
            
            if (pathinfo($template, PATHINFO_EXTENSION) == "tpl" && file_exists($template)) {
                return $template;
            }
    Severity: Minor
    Found in lib/Template.php - About 3 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 latestPosts has a Cognitive Complexity of 23 (exceeds 5 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: Minor
    Found in lib/Forums/Forums.php - About 3 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 getWeatherForecast has 81 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function getWeatherForecast($days = 14) {
            
            return false;
            
            $weather = false;
    Severity: Major
    Found in lib/Place.php - About 3 hrs to fix

      Method getPhotoContext has 81 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public static function getPhotoContext(Image $imageObject, $unapprovedOnly = null) {
              
              $Database = (new AppCore)->getDatabaseConnection(); 
              
              if ($unapprovedOnly == false || $unapprovedOnly == null) {
      Severity: Major
      Found in lib/Images/Utility/Finder.php - About 3 hrs to fix

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

            private function fetch($recurse) {
                
                if (!filter_var($this->id, FILTER_VALIDATE_INT)) {
                    $this->id = Utility\LocomotiveUtility::getClassId($this->id); 
                }
        Severity: Major
        Found in lib/Locos/LocoClass.php - About 3 hrs to fix

          Method getWOEData has 80 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public static function getWOEData($lookup = false, $types = false) {
                  if ($lookup === false) {
                      return false;
                  }
                  
          Severity: Major
          Found in lib/Place.php - About 3 hrs to fix

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

                    public function validate() {
                        if (empty( $this->title )) {
                            throw new Exception("Validation failed: title is empty");
                        }
            
            Severity: Minor
            Found in lib/News/Article.php - About 3 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 latest has a Cognitive Complexity of 22 (exceeds 5 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: Minor
            Found in lib/News/Base.php - About 3 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 commit has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
            Open

                    public function commit() {
            
                        $this->validate();
            
                        if (function_exists("prepare_submit")) {
            Severity: Minor
            Found in lib/News/Article.php - About 3 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

            AppCore has 26 functions (exceeds 20 allowed). Consider refactoring.
            Open

            class AppCore {
                
                /**
                 * Database object
                 * @var object $db An instance of ZendDB or sql_db representing a database connection.
            Severity: Minor
            Found in lib/AppCore.php - About 3 hrs to fix

              File Exif.php has 291 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              <?php
              
              /**
               * EXIF data handler
               * @since Version 3.10.0
              Severity: Minor
              Found in lib/Images/Exif.php - About 3 hrs to fix

                File Event.php has 291 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                <?php
                
                /**
                 * Railpage Events module
                 * @since Version 3.8.7
                Severity: Minor
                Found in lib/Events/Event.php - About 3 hrs to fix

                  Method getPhotosForSite has 74 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          public function getPhotosForSite($num = 10, $start = 0) {
                              
                              $Place = new Place($this->lat, $this->lon); 
                              
                              return $Place->getPhotosFromSphinx($num); 
                  Severity: Major
                  Found in lib/Locations/Location.php - About 2 hrs to fix
                    Severity
                    Category
                    Status
                    Source
                    Language