railpage/railpagecore

View on GitHub

Showing 708 of 9,214 total issues

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 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 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

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

                          public function commit() {
                  
                              $this->validate();
                  
                              if (function_exists("prepare_submit")) {
                  Severity: Major
                  Found in lib/News/Article.php - About 2 hrs to fix

                    Method GenerateTimeline has 73 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function GenerateTimeline($dateFrom, $dateTo) {
                            
                            $page = false;
                            $items_per_page = false;
                            
                    Severity: Major
                    Found in lib/Users/Timeline.php - About 2 hrs to fix

                      Function getImage has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function getImage($id, $force = 0) {
                              $params = array(
                                  "ImageKey" => $id
                              );
                              
                      Severity: Minor
                      Found in lib/Images/Provider/SmugMug.php - About 2 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 EmbedGoogleMap has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public static function EmbedGoogleMap(DOMElement $e) {
                              
                              $timer = Debug::GetTimer(); 
                              
                              $Config = AppCore::GetConfig(); 
                      Severity: Minor
                      Found in lib/Formatting/MultimediaUtility.php - About 2 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 getProviders has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function getProviders($region = null) {
                              $ritit = new RecursiveIteratorIterator(new RecursiveDirectoryIterator(__DIR__), RecursiveIteratorIterator::CHILD_FIRST); 
                              $providers = array(); 
                              
                              foreach ($ritit as $splFileInfo) {
                      Severity: Minor
                      Found in lib/GTFS/GTFS.php - About 2 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

                      Severity
                      Category
                      Status
                      Source
                      Language