railpage/railpagecore

View on GitHub

Showing 708 of 9,257 total issues

File User.php has 1132 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

/**
 * Base user class
 * @since   Version 3.0.1
Severity: Major
Found in lib/Users/User.php - About 2 days to fix

    File Image.php has 823 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    
    /**
     * Store and fetch image data from our local database
     *
    Severity: Major
    Found in lib/Images/Image.php - About 1 day to fix

      Function populate has a Cognitive Complexity of 89 (exceeds 5 allowed). Consider refactoring.
      Open

          public function populate($force = false, $option = null) {
      
              if ($force === false && !$this->isStale()) {
                  return $this;
              }
      Severity: Minor
      Found in lib/Images/Image.php - About 1 day 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 findObjects has a Cognitive Complexity of 87 (exceeds 5 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: Minor
      Found in lib/Images/Image.php - About 1 day 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 Competition.php has 654 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      
      /**
       * Photo competition!
       * @since Version 3.9.1
      Severity: Major
      Found in lib/Images/Competition.php - About 1 day to fix

        File Locomotive.php has 649 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        
        /** 
         * Loco database
         * @since Version 3.2
        Severity: Major
        Found in lib/Locos/Locomotive.php - About 1 day to fix

          File Forums.php has 648 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          <?php
          
          /**
           * Forums API
           * @since Version 3.0.1
          Severity: Major
          Found in lib/Forums/Forums.php - About 1 day to fix

            File LocoClass.php has 590 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            <?php
            
            /** 
             * Loco database
             * @since Version 3.2
            Severity: Major
            Found in lib/Locos/LocoClass.php - About 1 day to fix

              Function suggestLocos has a Cognitive Complexity of 62 (exceeds 5 allowed). Consider refactoring.
              Open

                  public static function suggestLocos(Image $imageObject, $skipTagged = null) {
                      
                      $locolookup = array();
                      $locos = array();
              
              Severity: Minor
              Found in lib/Images/Utility/Tagger.php - About 1 day 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 populate has 239 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function populate($force = false, $option = null) {
              
                      if ($force === false && !$this->isStale()) {
                          return $this;
                      }
              Severity: Major
              Found in lib/Images/Image.php - About 1 day to fix

                Function getPhotoLegacy has a Cognitive Complexity of 60 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function getPhotoLegacy($photo_id = false) {
                        if (!$photo_id) {
                            throw new Exception("Cannot fetch photo info and sizes - no photo ID given"); 
                            return false;
                        }
                Severity: Minor
                Found in lib/Railcams/Camera.php - About 1 day 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 59 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function __construct($user = false) {
                        if (!$user || !($user instanceof \Railpage\Users\User)) {
                            throw new \Exception("Cannot instantiate " . __CLASS__ . "::" . __FUNCTION__ . " - no \$user object given"); 
                            return false;
                        }
                Severity: Minor
                Found in lib/Forums/Permissions.php - About 1 day 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 Article.php has 543 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                <?php
                    /**
                     * News classes
                     * @since     Version 3.0.1
                     * @version   3.8.7
                Severity: Major
                Found in lib/News/Article.php - About 1 day to fix

                  Function parse has a Cognitive Complexity of 56 (exceeds 5 allowed). Consider refactoring.
                  Open

                          public function parse() {
                              if (empty($this->feeds)) {
                                  throw new Exception("No scraped RSS data was found (hint: Consume::scrape())");
                              }
                              
                  Severity: Minor
                  Found in lib/RSS/Consume.php - About 1 day 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 53 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function load() {
                          $photodata = $this->Provider->getPhoto($this->id);
                                  
                          $this->title = $photodata['title'];
                          $this->description = $photodata['description'];
                  Severity: Minor
                  Found in lib/Railcams/Photo.php - About 1 day 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 Locos.php has 472 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  <?php
                  
                  /** 
                   * Loco database
                   * @since Version 3.2
                  Severity: Minor
                  Found in lib/Locos/Locos.php - About 7 hrs to fix

                    Function buildACL has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function buildACL($force = false) {
                            
                            $Registry = Registry::getInstance(); 
                            
                            try {
                    Severity: Minor
                    Found in lib/Forums/Forums.php - About 7 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

                    User has 51 functions (exceeds 20 allowed). Consider refactoring.
                    Open

                    class User extends Base {
                    
                        /**
                         * Registry cache key
                         * @since Version 3.9.1
                    Severity: Major
                    Found in lib/Users/User.php - About 7 hrs to fix

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