railpage/railpagecore

View on GitHub
lib/Locos/Locos.php

Summary

Maintainability
F
1 wk
Test Coverage

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

    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

      The class Locos has 40 non-getter- and setter-methods. Consider refactoring Locos to keep number of methods under 25.
      Open

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

      TooManyMethods

      Since: 0.1

      A class with too many methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

      By default it ignores methods starting with 'get' or 'set'.

      The default was changed from 10 to 25 in PHPMD 2.3.

      Example

      Source https://phpmd.org/rules/codesize.html#toomanymethods

      The class Locos has 40 public methods. Consider refactoring Locos to keep number of public methods under 10.
      Open

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

      TooManyPublicMethods

      Since: 0.1

      A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

      By default it ignores methods starting with 'get' or 'set'.

      Example

      Source https://phpmd.org/rules/codesize.html#toomanypublicmethods

      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 Locos has 48 public methods and attributes. Consider reducing the number of public items to less than 45.
      Open

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

      ExcessivePublicCount

      Since: 0.1

      A large number of public methods and attributes declared in a class can indicate the class may need to be broken up as increased effort will be required to thoroughly test it.

      Example

      public class Foo {
          public $value;
          public $something;
          public $var;
          // [... more more public attributes ...]
      
          public function doWork() {}
          public function doMoreWork() {}
          public function doWorkAgain() {}
          // [... more more public methods ...]
      }

      Source https://phpmd.org/rules/codesize.html#excessivepubliccount

      Method listClasses has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function listClasses($types = null) {
              $params = array(); 
              $return = array(); 
              
              $suffix = $types === false ? "all" : (is_array($types) ? implode(",", $types) : $types); 
      Severity: Minor
      Found in lib/Locos/Locos.php - About 1 hr to fix

        Function getRandomClass has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            public function getRandomClass() {
                $query = "SELECT `id`, `desc`, flickr_image_id FROM loco_class WHERE `desc` != '' AND flickr_image_id > 0";
                
                $ids = array();
                
        Severity: Minor
        Found in lib/Locos/Locos.php - About 45 mins 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

        The class Locos has 1153 lines of code. Current threshold is 1000. Avoid really long classes.
        Open

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

        Missing class import via use statement (line '1011', column '32').
        Open

                    "timestamp" => new \Zend_Db_Expr("NOW()"),
        Severity: Minor
        Found in lib/Locos/Locos.php by phpmd

        MissingImport

        Since: 2.7.0

        Importing all external classes in a file through use statements makes them clearly visible.

        Example

        function make() {
            return new \stdClass();
        }

        Source http://phpmd.org/rules/cleancode.html#MissingImport

        Avoid unused parameters such as '$dateId'.
        Open

            public function loadDate($dateId = null) {
        Severity: Minor
        Found in lib/Locos/Locos.php by phpmd

        UnusedFormalParameter

        Since: 0.2

        Avoid passing parameters to methods or constructors and then not using those parameters.

        Example

        class Foo
        {
            private function bar($howdy)
            {
                // $howdy is not used
            }
        }

        Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter

        Avoid unused parameters such as '$dateId'.
        Open

            public function deleteDate($dateId = null) {
        Severity: Minor
        Found in lib/Locos/Locos.php by phpmd

        UnusedFormalParameter

        Since: 0.2

        Avoid passing parameters to methods or constructors and then not using those parameters.

        Example

        class Foo
        {
            private function bar($howdy)
            {
                // $howdy is not used
            }
        }

        Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter

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

            public function locosByOperator($operatorId = null) {
                
                if (!filter_var($operatorId, FILTER_VALIDATE_INT)) {
                    return false;
                }
        Severity: Major
        Found in lib/Locos/Locos.php and 1 other location - About 1 day to fix
        lib/Locos/Locos.php on lines 375..409

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

        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 locosByOwner($ownerId = null) {
                
                if (!filter_var($ownerId, FILTER_VALIDATE_INT)) {
                    return false;
                }
        Severity: Major
        Found in lib/Locos/Locos.php and 1 other location - About 1 day to fix
        lib/Locos/Locos.php on lines 332..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 186.

        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 3 locations. Consider refactoring.
        Open

            public function classByManufacturer() {
                $classes = $this->listClasses();
                
                $return = array(
                    "stat" => "err"
        Severity: Major
        Found in lib/Locos/Locos.php and 2 other locations - About 4 hrs to fix
        lib/Locos/Locos.php on lines 277..295
        lib/Locos/Locos.php on lines 304..322

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

        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 3 locations. Consider refactoring.
        Open

            public function classByWheelset() {
                $classes = $this->listClasses();
                
                $return = array(
                    "stat" => "err"
        Severity: Major
        Found in lib/Locos/Locos.php and 2 other locations - About 4 hrs to fix
        lib/Locos/Locos.php on lines 250..268
        lib/Locos/Locos.php on lines 304..322

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

        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 3 locations. Consider refactoring.
        Open

            public function classByType() {
                $classes = $this->listClasses();
                
                $return = array(
                    "stat" => "err"
        Severity: Major
        Found in lib/Locos/Locos.php and 2 other locations - About 4 hrs to fix
        lib/Locos/Locos.php on lines 250..268
        lib/Locos/Locos.php on lines 277..295

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

        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 deleteLink($id = null) {
                if (!filter_var($id, FILTER_VALIDATE_INT)) {
                    throw new Exception("Cannot delete loco  - no ID given"); 
                } 
        
        Severity: Major
        Found in lib/Locos/Locos.php and 1 other location - About 3 hrs to fix
        lib/Locos/Locos.php on lines 615..629

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

        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 deleteNote($noteId = null) {
                
                if (!filter_var($noteId, FILTER_VALIDATE_INT)) {
                    throw new InvalidArgumentException("No valid note ID was provided"); 
                } 
        Severity: Major
        Found in lib/Locos/Locos.php and 1 other location - About 3 hrs to fix
        lib/Locos/Locos.php on lines 797..809

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

        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 3 locations. Consider refactoring.
        Open

            public function getLastOperator($locoId = null) {
                if (!filter_var($locoId, FILTER_VALIDATE_INT)) {
                    throw new Exception("Could not get latest operator - no loco ID given"); 
                }
                
        Severity: Major
        Found in lib/Locos/Locos.php and 2 other locations - About 2 hrs to fix
        lib/Locos/Locos.php on lines 818..826
        lib/Locos/Locos.php on lines 866..874

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

        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 3 locations. Consider refactoring.
        Open

            public function getLastOwner($locoId = null) {
                if (!filter_var($locoId, FILTER_VALIDATE_INT)) {
                    throw new Exception("Could not get latest owner - no loco ID given"); 
                }
                
        Severity: Major
        Found in lib/Locos/Locos.php and 2 other locations - About 2 hrs to fix
        lib/Locos/Locos.php on lines 818..826
        lib/Locos/Locos.php on lines 883..891

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

        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 3 locations. Consider refactoring.
        Open

            public function getLink($id = null) {
                if (!filter_var($id, FILTER_VALIDATE_INT)) {
                    throw new Exception("Cannot fetch loco  - no ID given"); 
                }
                
        Severity: Major
        Found in lib/Locos/Locos.php and 2 other locations - About 2 hrs to fix
        lib/Locos/Locos.php on lines 866..874
        lib/Locos/Locos.php on lines 883..891

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

        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 addStatus($name = null) {
                if ($name == null) {
                    throw new Exception("No name was given for this status");
                }
                
        Severity: Major
        Found in lib/Locos/Locos.php and 1 other location - About 2 hrs to fix
        lib/Images/Images.php on lines 71..82

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

        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 randomPhoto() {
                $query = "SELECT photo_id FROM loco_unit WHERE photo_id > 0";
                
                $return = array(); 
                
        Severity: Major
        Found in lib/Locos/Locos.php and 1 other location - About 1 hr to fix
        lib/Locos/Liveries/Liveries.php on lines 28..38

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

        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

                foreach ($this->db->fetchAll($query, $locoUnitId) as $row) {
                    $return[$row['group_id']] = $row; 
                }
        Severity: Major
        Found in lib/Locos/Locos.php and 1 other location - About 1 hr to fix
        lib/Forums/Stats.php on lines 248..250

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

        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 15 locations. Consider refactoring.
        Open

            public function logEvent($userId = null, $title = null, $args = null) {
                
                if (!filter_var($userId, FILTER_VALIDATE_INT)) {
                    throw new Exception("Cannot log event, no User ID given"); 
                }
        Severity: Major
        Found in lib/Locos/Locos.php and 14 other locations - About 55 mins to fix
        lib/Downloads/Download.php on lines 384..403
        lib/Images/ImageFactory.php on lines 30..90
        lib/Images/Images.php on lines 95..126
        lib/Links/Category.php on lines 122..133
        lib/Locations/Locations.php on lines 356..397
        lib/Locos/Factory.php on lines 90..123
        lib/Locos/LocoClass.php on lines 1038..1061
        lib/Locos/Locomotive.php on lines 327..354
        lib/Locos/Locomotive.php on lines 711..745
        lib/Locos/Locomotive.php on lines 806..817
        lib/Locos/Locomotive.php on lines 1118..1144
        lib/Modules/Modules.php on lines 91..112
        lib/Notifications/Notification.php on lines 465..484
        lib/Users/Utility/PasswordUtility.php on lines 68..96

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

        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 (is_array($types)) {
                    $motive_power_types = " WHERE c.loco_type_id IN (".implode(",", $types).")";
                } elseif (is_int($types)) {
                    $motive_power_types = " WHERE c.loco_type_id IN (?)";
                    $params[] = $types;
        Severity: Minor
        Found in lib/Locos/Locos.php and 1 other location - About 45 mins to fix
        lib/SiteEvent/Base.php on lines 32..38

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

        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 22 locations. Consider refactoring.
        Open

                $this->Memcached->save($mckey, $return, strtotime("+1 week"));
        Severity: Major
        Found in lib/Locos/Locos.php and 21 other locations - About 40 mins to fix
        lib/Chronicle/Chronicle.php on lines 119..119
        lib/Config/Base.php on lines 40..40
        lib/Config/Base.php on lines 111..111
        lib/Downloads/Download.php on lines 530..530
        lib/Glossary/Glossary.php on lines 107..107
        lib/Images/Images.php on lines 110..110
        lib/Links/Links.php on lines 94..94
        lib/Links/Links.php on lines 129..129
        lib/Locations/Country.php on lines 179..179
        lib/Locations/Country.php on lines 180..180
        lib/Locations/Location.php on lines 811..811
        lib/Locations/Locations.php on lines 76..76
        lib/Locations/Locations.php on lines 127..127
        lib/Locations/Locations.php on lines 161..161
        lib/Locations/Locations.php on lines 474..474
        lib/Locos/Locomotive.php on lines 1227..1227
        lib/Locos/Locomotive.php on lines 1538..1538
        lib/PrivateMessages/Folder.php on lines 259..259
        lib/Users/Base.php on lines 82..82
        lib/Users/Timeline.php on lines 241..241
        lib/Place.php on lines 600..600

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

        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 loadDate($dateId = null) {
                
                throw new Exception("Deprecated function: use \Railpage\Locos\Date"); 
                
                /*
        Severity: Minor
        Found in lib/Locos/Locos.php and 1 other location - About 40 mins to fix
        lib/Locos/Locos.php on lines 679..695

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

        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 deleteDate($dateId = null) {
                
                throw new Exception("Deprecated function: use \Railpage\Locos\Date"); 
                
                /*
        Severity: Minor
        Found in lib/Locos/Locos.php and 1 other location - About 40 mins to fix
        lib/Locos/Locos.php on lines 657..670

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

        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 link(Locomotive $locoObjectA, Locomotive $locoObjectB, $linkTypeId = null) {
                if (!$locoObjectA instanceof Locomotive) {
                    throw new Exception("Cannot establish link between locomotives - Paramter 1 (Loco A) missing");
                }
                if (!$locoObjectB instanceof Locomotive) {
        Severity: Minor
        Found in lib/Locos/Locos.php and 1 other location - About 40 mins to fix
        lib/Images/Utility/CompetitionUtility.php on lines 365..393

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

        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 getStatistic($statistic, $param1 = null, $param2 = null) {
                
                if (!$statistic) {
                    throw new Exception("Cannot get module statistics - no statistic requested");
                }
        Severity: Minor
        Found in lib/Locos/Locos.php and 1 other location - About 40 mins to fix
        lib/ContentUtility.php on lines 132..186

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

        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 listManufacturers($force = null) {
                
                return Lister::getManufacturers($force); 
                
            }
        Severity: Minor
        Found in lib/Locos/Locos.php and 1 other location - About 40 mins to fix
        lib/Locos/Locos.php on lines 420..424

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

        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

                    case "railpage.locos.class.count" :
                        
                        $query = "SELECT count(id) AS count FROM loco_class";
                        return $this->db->fetchOne($query);
                        
        Severity: Minor
        Found in lib/Locos/Locos.php and 1 other location - About 40 mins to fix
        lib/Locos/Locos.php on lines 1108..1113

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

        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 listWheelArrangements($force = null) {
                
                return Lister::getWheelArrangements($force); 
                
            }
        Severity: Minor
        Found in lib/Locos/Locos.php and 1 other location - About 40 mins to fix
        lib/Locos/Locos.php on lines 435..439

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

        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

                    case "railpage.locos.loco.count" : 
                        
                        $query = "SELECT count(loco_id) AS count FROM loco_unit";
                        return $this->db->fetchOne($query);
                        
        Severity: Minor
        Found in lib/Locos/Locos.php and 1 other location - About 40 mins to fix
        lib/Locos/Locos.php on lines 1101..1106

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

        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 21 locations. Consider refactoring.
        Open

                if (is_null($model)) {
                    throw new Exception("Could not fetch list of classes - no production model given"); 
                }
        Severity: Major
        Found in lib/Locos/Locos.php and 20 other locations - About 35 mins to fix
        lib/Events/EventDate.php on lines 372..374
        lib/Images/Image.php on lines 963..965
        lib/Images/Image.php on lines 1095..1097
        lib/Images/Images.php on lines 96..98
        lib/Images/Images.php on lines 137..139
        lib/Locations/Region.php on lines 93..95
        lib/Locos/Locos.php on lines 590..592
        lib/Locos/Locos.php on lines 925..927
        lib/Railcams/Storage/LocalFS.php on lines 127..129
        lib/Users/User.php on lines 2572..2574
        lib/Users/User.php on lines 2576..2578
        lib/Users/User.php on lines 2584..2586
        lib/Users/Utility/PasswordUtility.php on lines 70..72
        lib/Users/Utility/PasswordUtility.php on lines 74..76
        lib/Users/Utility/PasswordUtility.php on lines 78..80
        lib/API.php on lines 124..126
        lib/API.php on lines 194..196
        lib/BanControl/BanControl.php on lines 243..245
        lib/BanControl/BanControl.php on lines 354..356
        lib/BanControl/BanControl.php on lines 358..360

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

        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 21 locations. Consider refactoring.
        Open

                if (is_null($name)) {
                    throw new Exception("Cannot add group - group name cannot be empty"); 
                }
        Severity: Major
        Found in lib/Locos/Locos.php and 20 other locations - About 35 mins to fix
        lib/Events/EventDate.php on lines 372..374
        lib/Images/Image.php on lines 963..965
        lib/Images/Image.php on lines 1095..1097
        lib/Images/Images.php on lines 96..98
        lib/Images/Images.php on lines 137..139
        lib/Locations/Region.php on lines 93..95
        lib/Locos/Locos.php on lines 590..592
        lib/Locos/Locos.php on lines 901..903
        lib/Railcams/Storage/LocalFS.php on lines 127..129
        lib/Users/User.php on lines 2572..2574
        lib/Users/User.php on lines 2576..2578
        lib/Users/User.php on lines 2584..2586
        lib/Users/Utility/PasswordUtility.php on lines 70..72
        lib/Users/Utility/PasswordUtility.php on lines 74..76
        lib/Users/Utility/PasswordUtility.php on lines 78..80
        lib/API.php on lines 124..126
        lib/API.php on lines 194..196
        lib/BanControl/BanControl.php on lines 243..245
        lib/BanControl/BanControl.php on lines 354..356
        lib/BanControl/BanControl.php on lines 358..360

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

        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 21 locations. Consider refactoring.
        Open

                if (is_null($noteText)) {
                    throw new InvalidArgumentException("No note text was provided"); 
                }
        Severity: Major
        Found in lib/Locos/Locos.php and 20 other locations - About 35 mins to fix
        lib/Events/EventDate.php on lines 372..374
        lib/Images/Image.php on lines 963..965
        lib/Images/Image.php on lines 1095..1097
        lib/Images/Images.php on lines 96..98
        lib/Images/Images.php on lines 137..139
        lib/Locations/Region.php on lines 93..95
        lib/Locos/Locos.php on lines 901..903
        lib/Locos/Locos.php on lines 925..927
        lib/Railcams/Storage/LocalFS.php on lines 127..129
        lib/Users/User.php on lines 2572..2574
        lib/Users/User.php on lines 2576..2578
        lib/Users/User.php on lines 2584..2586
        lib/Users/Utility/PasswordUtility.php on lines 70..72
        lib/Users/Utility/PasswordUtility.php on lines 74..76
        lib/Users/Utility/PasswordUtility.php on lines 78..80
        lib/API.php on lines 124..126
        lib/API.php on lines 194..196
        lib/BanControl/BanControl.php on lines 243..245
        lib/BanControl/BanControl.php on lines 354..356
        lib/BanControl/BanControl.php on lines 358..360

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

        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 10 locations. Consider refactoring.
        Open

                if (!$locoObjectA instanceof Locomotive) {
                    throw new Exception("Cannot establish link between locomotives - Paramter 1 (Loco A) missing");
                }
        Severity: Major
        Found in lib/Locos/Locos.php and 9 other locations - About 35 mins to fix
        lib/Chronicle/Provider/Locos.php on lines 45..47
        lib/Chronicle/Provider/Locos.php on lines 49..51
        lib/Chronicle/Provider/Railcams.php on lines 49..51
        lib/Chronicle/Provider/Railcams.php on lines 53..55
        lib/Events/Event.php on lines 388..390
        lib/Locos/Locos.php on lines 772..774
        lib/Notifications/Notification.php on lines 304..306
        lib/Railcams/Footage.php on lines 139..141
        lib/Users/Group.php on lines 352..354

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

        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 10 locations. Consider refactoring.
        Open

                if (!$locoObjectB instanceof Locomotive) {
                    throw new Exception("Cannot establish link between locomotives - Paramter 2 (Loco B) missing");
                }
        Severity: Major
        Found in lib/Locos/Locos.php and 9 other locations - About 35 mins to fix
        lib/Chronicle/Provider/Locos.php on lines 45..47
        lib/Chronicle/Provider/Locos.php on lines 49..51
        lib/Chronicle/Provider/Railcams.php on lines 49..51
        lib/Chronicle/Provider/Railcams.php on lines 53..55
        lib/Events/Event.php on lines 388..390
        lib/Locos/Locos.php on lines 769..771
        lib/Notifications/Notification.php on lines 304..306
        lib/Railcams/Footage.php on lines 139..141
        lib/Users/Group.php on lines 352..354

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

        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 3 locations. Consider refactoring.
        Open

                        return $this->db->fetchOne($query, array($param1, $param2));
        Severity: Minor
        Found in lib/Locos/Locos.php and 2 other locations - About 30 mins to fix
        lib/Jobs/Classifications.php on lines 31..31
        lib/Jobs/Locations.php on lines 59..59

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

        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 (strlen(trim($row['desc'])) > 5 && $row['flickr_image_id'] > 0) {
        Severity: Minor
        Found in lib/Locos/Locos.php and 1 other location - About 30 mins to fix
        lib/Jobs/Scraper.php on lines 314..314

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

        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

        Function closing brace must go on the next line following the body; found 1 blank lines before brace
        Open

            }
        Severity: Minor
        Found in lib/Locos/Locos.php by phpcodesniffer

        Function closing brace must go on the next line following the body; found 1 blank lines before brace
        Open

            }
        Severity: Minor
        Found in lib/Locos/Locos.php by phpcodesniffer

        Function closing brace must go on the next line following the body; found 1 blank lines before brace
        Open

            }
        Severity: Minor
        Found in lib/Locos/Locos.php by phpcodesniffer

        Function closing brace must go on the next line following the body; found 1 blank lines before brace
        Open

            }
        Severity: Minor
        Found in lib/Locos/Locos.php by phpcodesniffer

        Function closing brace must go on the next line following the body; found 1 blank lines before brace
        Open

            }
        Severity: Minor
        Found in lib/Locos/Locos.php by phpcodesniffer

        Function closing brace must go on the next line following the body; found 1 blank lines before brace
        Open

            }
        Severity: Minor
        Found in lib/Locos/Locos.php by phpcodesniffer

        Function closing brace must go on the next line following the body; found 1 blank lines before brace
        Open

            }
        Severity: Minor
        Found in lib/Locos/Locos.php by phpcodesniffer

        Function closing brace must go on the next line following the body; found 1 blank lines before brace
        Open

            }
        Severity: Minor
        Found in lib/Locos/Locos.php by phpcodesniffer

        The CASE body must start on the line following the statement
        Open

                    case "railpage.locos.class.count" :
        Severity: Minor
        Found in lib/Locos/Locos.php by phpcodesniffer

        The CASE body must start on the line following the statement
        Open

                    case "railpage.locos.loco.count" : 
        Severity: Minor
        Found in lib/Locos/Locos.php by phpcodesniffer

        Function closing brace must go on the next line following the body; found 1 blank lines before brace
        Open

            }
        Severity: Minor
        Found in lib/Locos/Locos.php by phpcodesniffer

        Blank line found at start of control structure
        Open

                switch ($statistic) {
        Severity: Minor
        Found in lib/Locos/Locos.php by phpcodesniffer

        Function closing brace must go on the next line following the body; found 1 blank lines before brace
        Open

            }
        Severity: Minor
        Found in lib/Locos/Locos.php by phpcodesniffer

        Function closing brace must go on the next line following the body; found 1 blank lines before brace
        Open

            }
        Severity: Minor
        Found in lib/Locos/Locos.php by phpcodesniffer

        Function closing brace must go on the next line following the body; found 1 blank lines before brace
        Open

            }
        Severity: Minor
        Found in lib/Locos/Locos.php by phpcodesniffer

        Function closing brace must go on the next line following the body; found 1 blank lines before brace
        Open

            }
        Severity: Minor
        Found in lib/Locos/Locos.php by phpcodesniffer

        Function closing brace must go on the next line following the body; found 1 blank lines before brace
        Open

            }
        Severity: Minor
        Found in lib/Locos/Locos.php by phpcodesniffer

        Function closing brace must go on the next line following the body; found 1 blank lines before brace
        Open

            }
        Severity: Minor
        Found in lib/Locos/Locos.php by phpcodesniffer

        Function closing brace must go on the next line following the body; found 1 blank lines before brace
        Open

            }
        Severity: Minor
        Found in lib/Locos/Locos.php by phpcodesniffer

        Blank line found at end of control structure
        Open

                    
        Severity: Minor
        Found in lib/Locos/Locos.php by phpcodesniffer

        The CASE body must start on the line following the statement
        Open

                    case "railpage.locos.status.count" : 
        Severity: Minor
        Found in lib/Locos/Locos.php by phpcodesniffer

        Function closing brace must go on the next line following the body; found 1 blank lines before brace
        Open

            }
        Severity: Minor
        Found in lib/Locos/Locos.php by phpcodesniffer

        Function closing brace must go on the next line following the body; found 1 blank lines before brace
        Open

            }
        Severity: Minor
        Found in lib/Locos/Locos.php by phpcodesniffer

        Function closing brace must go on the next line following the body; found 1 blank lines before brace
        Open

            }
        Severity: Minor
        Found in lib/Locos/Locos.php by phpcodesniffer

        Function closing brace must go on the next line following the body; found 1 blank lines before brace
        Open

            }
        Severity: Minor
        Found in lib/Locos/Locos.php by phpcodesniffer

        Function closing brace must go on the next line following the body; found 1 blank lines before brace
        Open

            }
        Severity: Minor
        Found in lib/Locos/Locos.php by phpcodesniffer

        There are no issues that match your filters.

        Category
        Status