railpage/railpagecore

View on GitHub

Showing 708 of 9,214 total issues

Method buildACL has 96 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function buildACL($force = false) {
        
        $Registry = Registry::getInstance(); 
        
        try {
Severity: Major
Found in lib/Forums/Forums.php - About 3 hrs to fix

    Competition has 31 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Competition extends AppCore {
        
        /**
         * Registry key
         * @since Version 3.10.0
    Severity: Minor
    Found in lib/Images/Competition.php - About 3 hrs to fix

      Method getRegions has 95 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              public function getRegions($country = false) {
                  $query = "SELECT COUNT(l.id) AS count, l.region_slug AS slug,
                      g.region_name AS name, g.region_code, g.timezone
                      FROM location AS l 
                          LEFT JOIN geoplace AS g ON l.geoplace = g.id 
      Severity: Major
      Found in lib/Locations/Country.php - About 3 hrs to fix

        File Locations.php has 324 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

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

          Function getWOEData has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
          Open

              public static function getWOEData($lookup = false, $types = false) {
                  if ($lookup === false) {
                      return false;
                  }
                  
          Severity: Minor
          Found in lib/Place.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 find has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
          Open

              public static function find() {
                  
                  $args       = func_get_args(); 
                  $Loco       = false;
                  $LocoClass  = false;
          Severity: Minor
          Found in lib/Images/Utility/Finder.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 getImageFromUrl has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
          Open

              public function getImageFromUrl($url = null, $option = null) {
                  
                  /**
                   * Flickr
                   */
          Severity: Minor
          Found in lib/Images/Images.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 load has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
          Open

              private function load($option = null) {
          
                  Debug::RecordInstance();
          
                  $this->mckey = sprintf("railpage:image=%d", $this->id);
          Severity: Minor
          Found in lib/Images/Image.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 __construct has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
          Open

              public function __construct() {
                  global $ZendDB, $ZendDB_ReadOnly, $PHPUnitTest;
                  
                  /**
                   * Create the registry
          Severity: Minor
          Found in lib/AppCore.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 LatLonWoELookup has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
          Open

              public static function LatLonWoELookup($lat, $lon, $force = false) {
                  
                  if (is_null($lon) && strpos($lat, ",") !== false) {
                      $tmp = explode(",", $lat); 
                      $lat = $tmp[0];
          Severity: Minor
          Found in lib/PlaceUtility.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 render has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
          Open

              public function render() {
                  
                  if (!$this->userObject instanceof User) {
                      throw new InvalidArgumentException("No valid user object has been provided"); 
                  }
          Severity: Minor
          Found in lib/Prerender/Home.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 format has 88 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public static function format($userAvatar = null, $width = 100, $height = 100) {
                  if (is_null($userAvatar)) {
                      return false;
                  }
                  
          Severity: Major
          Found in lib/Users/Utility/AvatarUtility.php - About 3 hrs to fix

            Method findObjects has 88 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function findObjects($namespace = null, $force = false) {
            
                    if (is_null($namespace)) {
                        throw new Exception("Parameter 1 (namespace) cannot be empty");
                    }
            Severity: Major
            Found in lib/Images/Image.php - About 3 hrs to fix

              Method suggestLocos has 88 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public static function suggestLocos(Image $imageObject, $skipTagged = null) {
                      
                      $locolookup = array();
                      $locos = array();
              
              Severity: Major
              Found in lib/Images/Utility/Tagger.php - About 3 hrs to fix

                LocoClass has 29 functions (exceeds 20 allowed). Consider refactoring.
                Open

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

                  Method personaliseContent has 87 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          private function personaliseContent() {
                              
                              $replacements = array(); 
                              
                              Debug::LogCLI("Looping through " . count($this->recipients) . " users and preparing email decoration"); 
                  Severity: Major
                  Found in lib/Newsletters/Weekly.php - About 3 hrs to fix

                    Function personaliseContent has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
                    Open

                            private function personaliseContent() {
                                
                                $replacements = array(); 
                                
                                Debug::LogCLI("Looping through " . count($this->recipients) . " users and preparing email decoration"); 
                    Severity: Minor
                    Found in lib/Newsletters/Weekly.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 updateFeaturedImage has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function updateFeaturedImage() {
                            
                            $data = array(
                                "featured_photo" => $this->featured_photo_id
                            );
                    Severity: Minor
                    Found in lib/Gallery/Album.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

                    File CompetitionUtility.php has 306 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    <?php
                    
                    /**
                     * Photo competition utility class
                     * @since Version 3.9.1
                    Severity: Minor
                    Found in lib/Images/Utility/CompetitionUtility.php - About 3 hrs to fix

                      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
                        Severity
                        Category
                        Status
                        Source
                        Language