railpage/railpagecore

View on GitHub

Showing 9,214 of 9,214 total issues

Locos has 48 functions (exceeds 20 allowed). Consider refactoring.
Open

class Locos extends AppCore {
    
    /**
     * Status : Operational
     * @since Version 3.8.7
Severity: Minor
Found in lib/Locos/Locos.php - About 6 hrs to fix

    File Finder.php has 430 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    
    /**
     * Find images
     * @since Version 3.9.1
    Severity: Minor
    Found in lib/Images/Utility/Finder.php - About 6 hrs to fix

      Function format has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function format($userAvatar = null, $width = 100, $height = 100) {
              if (is_null($userAvatar)) {
                  return false;
              }
              
      Severity: Minor
      Found in lib/Users/Utility/AvatarUtility.php - About 6 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

      File Camera.php has 423 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      
      /**
       * Railcam object
       * @since Version 3.4
      Severity: Minor
      Found in lib/Railcams/Camera.php - About 6 hrs to fix

        File Place.php has 419 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        
        /**
         * Where on Earth is this place?
         * Geolookup
        Severity: Minor
        Found in lib/Place.php - About 6 hrs to fix

          File Location.php has 417 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          <?php
              /**
               * Locations module 
               * @since Version 3.0
               * @package Railpage
          Severity: Minor
          Found in lib/Locations/Location.php - About 6 hrs to fix

            Locomotive has 43 functions (exceeds 20 allowed). Consider refactoring.
            Open

            class Locomotive extends Locos {
                
                /**
                 * Registry cache key
                 * @since Version 3.9.1
            Severity: Minor
            Found in lib/Locos/Locomotive.php - About 5 hrs to fix

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                                          "largest"  => array(
                                              "width"  => $json['feed']['gphoto$width']['$t'],
                                              "height" => $json['feed']['gphoto$height']['$t'],
                                              "source" => str_replace(
                                                  sprintf("/s%d/", $json['feed']['media$group']['media$thumbnail'][0]['width']),
              Severity: Major
              Found in lib/Images/Image.php and 1 other location - About 5 hrs to fix
              lib/Images/Image.php on lines 747..755

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 130.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                                          "original" => array(
                                              "width"  => $json['feed']['gphoto$width']['$t'],
                                              "height" => $json['feed']['gphoto$height']['$t'],
                                              "source" => str_replace(
                                                  sprintf("/s%d/", $json['feed']['media$group']['media$thumbnail'][0]['width']),
              Severity: Major
              Found in lib/Images/Image.php and 1 other location - About 5 hrs to fix
              lib/Images/Image.php on lines 756..764

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 130.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              File Post.php has 405 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              <?php
              
              /**
               * Forums API
               * @since Version 3.0.1
              Severity: Minor
              Found in lib/Forums/Post.php - About 5 hrs to fix

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                    public function username_available($username = null) {
                        
                        if ($username == null) {
                            return false;
                        }
                Severity: Major
                Found in lib/Users/Base.php and 1 other location - About 5 hrs to fix
                lib/Users/Base.php on lines 347..365

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 128.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                    public function email_available($email = null) {
                        
                        if ($email == null) {
                            return false;
                        }
                Severity: Major
                Found in lib/Users/Base.php and 1 other location - About 5 hrs to fix
                lib/Users/Base.php on lines 318..336

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 128.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                File BanControl.php has 404 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                <?php
                
                /**
                 * Ban controller
                 * @since Version 3.2
                Severity: Minor
                Found in lib/BanControl/BanControl.php - About 5 hrs to fix

                  File AppCore.php has 396 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  <?php
                  
                  /**
                   * Railpage AppCore
                   * @since Version 3.7
                  Severity: Minor
                  Found in lib/AppCore.php - About 5 hrs to fix

                    Similar blocks of code found in 2 locations. Consider refactoring.
                    Open

                            if (RP_DEBUG) {
                                if ($rs === false) {
                                    $site_debug[] = "Zend_DB: FAILED create url slug for link category ID " . $categoryId . " in " . round(microtime(true) - $debug_timer_start, 5) . "s";
                                } else {
                                    $site_debug[] = "Zend_DB: SUCCESS create url slug for link category ID " . $categoryId . " in " . round(microtime(true) - $debug_timer_start, 5) . "s";
                    Severity: Major
                    Found in lib/Links/Links.php and 1 other location - About 5 hrs to fix
                    lib/News/Base.php on lines 386..392

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 121.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Similar blocks of code found in 2 locations. Consider refactoring.
                    Open

                                if (RP_DEBUG) {
                                    if ($rs === false) {
                                        $site_debug[] = "Zend_DB: FAILED create url slug for story ID " . $story_id . " in " . round(microtime(true) - $debug_timer_start, 5) . "s";
                                    } else {
                                        $site_debug[] = "Zend_DB: SUCCESS create url slug for story ID " . $story_id . " in " . round(microtime(true) - $debug_timer_start, 5) . "s";
                    Severity: Major
                    Found in lib/News/Base.php and 1 other location - About 5 hrs to fix
                    lib/Links/Links.php on lines 344..350

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 121.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Similar blocks of code found in 2 locations. Consider refactoring.
                    Open

                        public static function getScreenersChoice() {
                            
                            $Database = (new AppCore)->getDatabaseConnection(); 
                            
                            $query = "SELECT SQL_CALC_FOUND_ROWS image.*, g.country_code, g.country_name, g.region_code, 
                    Severity: Major
                    Found in lib/Images/Utility/Finder.php and 1 other location - About 5 hrs to fix
                    lib/Images/Utility/Finder.php on lines 424..454

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 120.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Similar blocks of code found in 2 locations. Consider refactoring.
                    Open

                        public static function getPhotoPool() {
                            
                            $Database = (new AppCore)->getDatabaseConnection(); 
                            
                            $query = "SELECT SQL_CALC_FOUND_ROWS image.*, g.country_code, g.country_name, g.region_code, 
                    Severity: Major
                    Found in lib/Images/Utility/Finder.php and 1 other location - About 5 hrs to fix
                    lib/Images/Utility/Finder.php on lines 525..556

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 120.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Similar blocks of code found in 2 locations. Consider refactoring.
                    Open

                        public function previous() {
                            $context = $this->Provider->getPhotoContext($this);
                            
                            if (isset($context['previous']) && isset($context['previous']['id']) && filter_var($context['previous']['id'], FILTER_VALIDATE_INT)) {
                                $Photo = (new Photo($context['previous']['id']))->setProvider($this->Provider)->setCamera($this->Camera)->load(); 
                    Severity: Major
                    Found in lib/Railcams/Photo.php and 1 other location - About 5 hrs to fix
                    lib/Railcams/Photo.php on lines 290..300

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 119.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Similar blocks of code found in 2 locations. Consider refactoring.
                    Open

                        public function next() {
                            $context = $this->Provider->getPhotoContext($this);
                            
                            if (isset($context['next']) && isset($context['next']['id']) && filter_var($context['next']['id'], FILTER_VALIDATE_INT)) {
                                $Photo = (new Photo($context['next']['id']))->setProvider($this->Provider)->setCamera($this->Camera)->load(); 
                    Severity: Major
                    Found in lib/Railcams/Photo.php and 1 other location - About 5 hrs to fix
                    lib/Railcams/Photo.php on lines 272..282

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 119.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Severity
                    Category
                    Status
                    Source
                    Language