railpage/railpagecore

View on GitHub
lib/Users/User.php

Summary

Maintainability
F
2 wks
Test Coverage

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

    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

      The class User has an overall complexity of 267 which is very high. The configured complexity threshold is 50.
      Open

      class User extends Base {
      
          /**
           * Registry cache key
           * @since Version 3.9.1
      Severity: Minor
      Found in lib/Users/User.php by phpmd

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

      class User extends Base {
      
          /**
           * Registry cache key
           * @since Version 3.9.1
      Severity: Minor
      Found in lib/Users/User.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 User has 33 public methods. Consider refactoring User to keep number of public methods under 10.
      Open

      class User extends Base {
      
          /**
           * Registry cache key
           * @since Version 3.9.1
      Severity: Minor
      Found in lib/Users/User.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

      Method load has 68 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function load($userId = false) {
      
              if (filter_var($userId, FILTER_VALIDATE_INT)) {
                  $this->id = $userId;
              }
      Severity: Major
      Found in lib/Users/User.php - About 2 hrs to fix

        Function validate has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
        Open

            public function validate($ignore = false) {
        
                if (empty( $this->username )) {
                    throw new Exception("Username cannot be empty");
                }
        Severity: Minor
        Found in lib/Users/User.php - About 2 hrs to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Function validatePassword has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
        Open

            public function validatePassword($password = false, $username = false) {
                
                Utility\PasswordUtility::validateParameters($password, $username, $this); 
        
                /**
        Severity: Minor
        Found in lib/Users/User.php - About 2 hrs to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Method validatePassword has 57 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function validatePassword($password = false, $username = false) {
                
                Utility\PasswordUtility::validateParameters($password, $username, $this); 
        
                /**
        Severity: Major
        Found in lib/Users/User.php - About 2 hrs to fix

          Function newAPIKey has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
          Open

              public function newAPIKey() {
          
                  $len = 32;
          
                  if (@is_readable('/dev/urandom')) {
          Severity: Minor
          Found in lib/Users/User.php - About 2 hrs to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Method getAlerts has 48 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function getAlerts(\Zend_Acl $acl) {
          
                  $query = array();
                  $params = array();
          
          Severity: Minor
          Found in lib/Users/User.php - About 1 hr to fix

            Method validate has 41 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function validate($ignore = false) {
            
                    if (empty( $this->username )) {
                        throw new Exception("Username cannot be empty");
                    }
            Severity: Minor
            Found in lib/Users/User.php - About 1 hr to fix

              Function tryAutoLogin has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function tryAutoLogin() {
              
                      if (is_null(filter_input(INPUT_COOKIE, "rp_autologin"))) { #empty($_COOKIE['rp_autologin'])) {
                          $this->addNote("Autologin attempted but no autologin cookie was found");
              
              Severity: Minor
              Found in lib/Users/User.php - About 1 hr 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 13 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function load($userId = false) {
              
                      if (filter_var($userId, FILTER_VALIDATE_INT)) {
                          $this->id = $userId;
                      }
              Severity: Minor
              Found in lib/Users/User.php - About 1 hr 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 updateHash has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function updateHash() {
              
                      $cookie = is_null(filter_input(INPUT_COOKIE, "rp_userhash")) ? "" : filter_input(INPUT_COOKIE, "rp_userhash"); # isset($_COOKIE['rp_userhash']) ? $_COOKIE['rp_userhash'] : "";
                      $hash = array();
                      $update = false;
              Severity: Minor
              Found in lib/Users/User.php - About 1 hr 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 getWatchedThreads has 39 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function getWatchedThreads($page = 1, $limit = null) {
              
                      // Assume Zend_Db
              
                      if (!filter_var($limit, FILTER_VALIDATE_INT)) {
              Severity: Minor
              Found in lib/Users/User.php - About 1 hr to fix

                The class User has 94 fields. Consider redesigning User to keep the number of fields under 15.
                Open

                class User extends Base {
                
                    /**
                     * Registry cache key
                     * @since Version 3.9.1
                Severity: Minor
                Found in lib/Users/User.php by phpmd

                TooManyFields

                Since: 0.1

                Classes that have too many fields could be redesigned to have fewer fields, possibly through some nested object grouping of some of the information. For example, a class with city/state/zip fields could instead have one Address field.

                Example

                class Person {
                   protected $one;
                   private $two;
                   private $three;
                   [... many more fields ...]
                }

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

                Function validateAvatar has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function validateAvatar($force = false) {
                
                        if (!empty( $this->avatar )) {
                            if ($force || ( empty( $this->avatar_width ) || empty( $this->avatar_height ) || $this->avatar_width == 0 || $this->avatar_height == 0 )) {
                                if ($size = @getimagesize($this->avatar)) {
                Severity: Minor
                Found in lib/Users/User.php - About 1 hr 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 tryAutoLogin has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function tryAutoLogin() {
                
                        if (is_null(filter_input(INPUT_COOKIE, "rp_autologin"))) { #empty($_COOKIE['rp_autologin'])) {
                            $this->addNote("Autologin attempted but no autologin cookie was found");
                
                Severity: Minor
                Found in lib/Users/User.php - About 1 hr to fix

                  Method updateHash has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function updateHash() {
                  
                          $cookie = is_null(filter_input(INPUT_COOKIE, "rp_userhash")) ? "" : filter_input(INPUT_COOKIE, "rp_userhash"); # isset($_COOKIE['rp_userhash']) ? $_COOKIE['rp_userhash'] : "";
                          $hash = array();
                          $update = false;
                  Severity: Minor
                  Found in lib/Users/User.php - About 1 hr to fix

                    Method newAPIKey has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function newAPIKey() {
                    
                            $len = 32;
                    
                            if (@is_readable('/dev/urandom')) {
                    Severity: Minor
                    Found in lib/Users/User.php - About 1 hr to fix

                      Method setAutoLogin has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function setAutoLogin($cookieExpire) {
                      
                              if (empty( $cookieExpire )) {
                                  $cookieExpire = RP_AUTOLOGIN_EXPIRE;
                              }
                      Severity: Minor
                      Found in lib/Users/User.php - About 1 hr to fix

                        The class User has 143 public methods and attributes. Consider reducing the number of public items to less than 45.
                        Open

                        class User extends Base {
                        
                            /**
                             * Registry cache key
                             * @since Version 3.9.1
                        Severity: Minor
                        Found in lib/Users/User.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 commit has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function commit($force = false) {
                        
                                $this->validate($force);
                        
                                Utility\UserUtility::clearCache($this);
                        Severity: Minor
                        Found in lib/Users/User.php - About 1 hr to fix

                          Method getPreferences has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public function getPreferences($section = false) {
                          
                                  $prefs = is_object($this->preferences) ? json_decode(json_encode($this->preferences), true) : $this->preferences;
                          
                                  if (is_string($prefs)) {
                          Severity: Minor
                          Found in lib/Users/User.php - About 1 hr to fix

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

                                public function guest() {
                            
                                    $this->lang = "english";
                                    $this->date_format = "d M Y H:i";
                                    $this->avatar_filename = "blank.png";
                            Severity: Minor
                            Found in lib/Users/User.php - About 1 hr to fix

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

                                  public function __construct() {
                              
                                      $timer = Debug::getTimer();
                              
                                      Debug::RecordInstance();
                              Severity: Minor
                              Found in lib/Users/User.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

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

                                  public function recordLogin($clientAddr = false) {
                              
                                      if (!filter_var($this->id, FILTER_VALIDATE_INT)) {
                                          return false;
                                      }
                              Severity: Minor
                              Found in lib/Users/User.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

                              Function commit has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  public function commit($force = false) {
                              
                                      $this->validate($force);
                              
                                      Utility\UserUtility::clearCache($this);
                              Severity: Minor
                              Found in lib/Users/User.php - About 35 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

                              Function loadNotes has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  public function loadNotes() {
                              
                                      if (!filter_var($this->id, FILTER_VALIDATE_INT)) {
                                          return false;
                                      }
                              Severity: Minor
                              Found in lib/Users/User.php - About 35 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

                              Function getLogins has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  public function getLogins($itemsPerPage = 25, $page = 1) {
                              
                                      if (!filter_var($this->id, FILTER_VALIDATE_INT)) {
                                          return false;
                                      }
                              Severity: Minor
                              Found in lib/Users/User.php - About 35 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

                              Avoid too many return statements within this method.
                              Open

                                      return "guest";
                              Severity: Major
                              Found in lib/Users/User.php - About 30 mins to fix

                                Function getPreferences has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    public function getPreferences($section = false) {
                                
                                        $prefs = is_object($this->preferences) ? json_decode(json_encode($this->preferences), true) : $this->preferences;
                                
                                        if (is_string($prefs)) {
                                Severity: Minor
                                Found in lib/Users/User.php - About 25 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

                                Function getWatchedThreads has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    public function getWatchedThreads($page = 1, $limit = null) {
                                
                                        // Assume Zend_Db
                                
                                        if (!filter_var($limit, FILTER_VALIDATE_INT)) {
                                Severity: Minor
                                Found in lib/Users/User.php - About 25 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

                                Function getAlerts has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    public function getAlerts(\Zend_Acl $acl) {
                                
                                        $query = array();
                                        $params = array();
                                
                                Severity: Minor
                                Found in lib/Users/User.php - About 25 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

                                Function getGroups has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    public function getGroups($force = null) {
                                
                                        if (!filter_var($this->id, FILTER_VALIDATE_INT)) {
                                            return false;
                                        }
                                Severity: Minor
                                Found in lib/Users/User.php - About 25 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 User has 2888 lines of code. Current threshold is 1000. Avoid really long classes.
                                Open

                                class User extends Base {
                                
                                    /**
                                     * Registry cache key
                                     * @since Version 3.9.1
                                Severity: Minor
                                Found in lib/Users/User.php by phpmd

                                The method validate() has an NPath complexity of 14976. The configured NPath complexity threshold is 200.
                                Open

                                    public function validate($ignore = false) {
                                
                                        if (empty( $this->username )) {
                                            throw new Exception("Username cannot be empty");
                                        }
                                Severity: Minor
                                Found in lib/Users/User.php by phpmd

                                NPathComplexity

                                Since: 0.1

                                The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

                                Example

                                class Foo {
                                    function bar() {
                                        // lots of complicated code
                                    }
                                }

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

                                The method validatePassword() has 110 lines of code. Current threshold is set to 100. Avoid really long methods.
                                Open

                                    public function validatePassword($password = false, $username = false) {
                                        
                                        Utility\PasswordUtility::validateParameters($password, $username, $this); 
                                
                                        /**
                                Severity: Minor
                                Found in lib/Users/User.php by phpmd

                                The method load() has 136 lines of code. Current threshold is set to 100. Avoid really long methods.
                                Open

                                    public function load($userId = false) {
                                
                                        if (filter_var($userId, FILTER_VALIDATE_INT)) {
                                            $this->id = $userId;
                                        }
                                Severity: Minor
                                Found in lib/Users/User.php by phpmd

                                The method validatePassword() has an NPath complexity of 2340. The configured NPath complexity threshold is 200.
                                Open

                                    public function validatePassword($password = false, $username = false) {
                                        
                                        Utility\PasswordUtility::validateParameters($password, $username, $this); 
                                
                                        /**
                                Severity: Minor
                                Found in lib/Users/User.php by phpmd

                                NPathComplexity

                                Since: 0.1

                                The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

                                Example

                                class Foo {
                                    function bar() {
                                        // lots of complicated code
                                    }
                                }

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

                                The method load() has an NPath complexity of 27648. The configured NPath complexity threshold is 200.
                                Open

                                    public function load($userId = false) {
                                
                                        if (filter_var($userId, FILTER_VALIDATE_INT)) {
                                            $this->id = $userId;
                                        }
                                Severity: Minor
                                Found in lib/Users/User.php by phpmd

                                NPathComplexity

                                Since: 0.1

                                The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

                                Example

                                class Foo {
                                    function bar() {
                                        // lots of complicated code
                                    }
                                }

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

                                The method updateHash() has a Cyclomatic Complexity of 10. The configured cyclomatic complexity threshold is 10.
                                Open

                                    public function updateHash() {
                                
                                        $cookie = is_null(filter_input(INPUT_COOKIE, "rp_userhash")) ? "" : filter_input(INPUT_COOKIE, "rp_userhash"); # isset($_COOKIE['rp_userhash']) ? $_COOKIE['rp_userhash'] : "";
                                        $hash = array();
                                        $update = false;
                                Severity: Minor
                                Found in lib/Users/User.php by phpmd

                                CyclomaticComplexity

                                Since: 0.1

                                Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

                                Example

                                // Cyclomatic Complexity = 11
                                class Foo {
                                1   public function example() {
                                2       if ($a == $b) {
                                3           if ($a1 == $b1) {
                                                fiddle();
                                4           } elseif ($a2 == $b2) {
                                                fiddle();
                                            } else {
                                                fiddle();
                                            }
                                5       } elseif ($c == $d) {
                                6           while ($c == $d) {
                                                fiddle();
                                            }
                                7        } elseif ($e == $f) {
                                8           for ($n = 0; $n < $h; $n++) {
                                                fiddle();
                                            }
                                        } else {
                                            switch ($z) {
                                9               case 1:
                                                    fiddle();
                                                    break;
                                10              case 2:
                                                    fiddle();
                                                    break;
                                11              case 3:
                                                    fiddle();
                                                    break;
                                                default:
                                                    fiddle();
                                                    break;
                                            }
                                        }
                                    }
                                }

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

                                The method validateAvatar() has a Cyclomatic Complexity of 12. The configured cyclomatic complexity threshold is 10.
                                Open

                                    public function validateAvatar($force = false) {
                                
                                        if (!empty( $this->avatar )) {
                                            if ($force || ( empty( $this->avatar_width ) || empty( $this->avatar_height ) || $this->avatar_width == 0 || $this->avatar_height == 0 )) {
                                                if ($size = @getimagesize($this->avatar)) {
                                Severity: Minor
                                Found in lib/Users/User.php by phpmd

                                CyclomaticComplexity

                                Since: 0.1

                                Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

                                Example

                                // Cyclomatic Complexity = 11
                                class Foo {
                                1   public function example() {
                                2       if ($a == $b) {
                                3           if ($a1 == $b1) {
                                                fiddle();
                                4           } elseif ($a2 == $b2) {
                                                fiddle();
                                            } else {
                                                fiddle();
                                            }
                                5       } elseif ($c == $d) {
                                6           while ($c == $d) {
                                                fiddle();
                                            }
                                7        } elseif ($e == $f) {
                                8           for ($n = 0; $n < $h; $n++) {
                                                fiddle();
                                            }
                                        } else {
                                            switch ($z) {
                                9               case 1:
                                                    fiddle();
                                                    break;
                                10              case 2:
                                                    fiddle();
                                                    break;
                                11              case 3:
                                                    fiddle();
                                                    break;
                                                default:
                                                    fiddle();
                                                    break;
                                            }
                                        }
                                    }
                                }

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

                                The method validate() has a Cyclomatic Complexity of 17. The configured cyclomatic complexity threshold is 10.
                                Open

                                    public function validate($ignore = false) {
                                
                                        if (empty( $this->username )) {
                                            throw new Exception("Username cannot be empty");
                                        }
                                Severity: Minor
                                Found in lib/Users/User.php by phpmd

                                CyclomaticComplexity

                                Since: 0.1

                                Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

                                Example

                                // Cyclomatic Complexity = 11
                                class Foo {
                                1   public function example() {
                                2       if ($a == $b) {
                                3           if ($a1 == $b1) {
                                                fiddle();
                                4           } elseif ($a2 == $b2) {
                                                fiddle();
                                            } else {
                                                fiddle();
                                            }
                                5       } elseif ($c == $d) {
                                6           while ($c == $d) {
                                                fiddle();
                                            }
                                7        } elseif ($e == $f) {
                                8           for ($n = 0; $n < $h; $n++) {
                                                fiddle();
                                            }
                                        } else {
                                            switch ($z) {
                                9               case 1:
                                                    fiddle();
                                                    break;
                                10              case 2:
                                                    fiddle();
                                                    break;
                                11              case 3:
                                                    fiddle();
                                                    break;
                                                default:
                                                    fiddle();
                                                    break;
                                            }
                                        }
                                    }
                                }

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

                                The method load() has a Cyclomatic Complexity of 18. The configured cyclomatic complexity threshold is 10.
                                Open

                                    public function load($userId = false) {
                                
                                        if (filter_var($userId, FILTER_VALIDATE_INT)) {
                                            $this->id = $userId;
                                        }
                                Severity: Minor
                                Found in lib/Users/User.php by phpmd

                                CyclomaticComplexity

                                Since: 0.1

                                Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

                                Example

                                // Cyclomatic Complexity = 11
                                class Foo {
                                1   public function example() {
                                2       if ($a == $b) {
                                3           if ($a1 == $b1) {
                                                fiddle();
                                4           } elseif ($a2 == $b2) {
                                                fiddle();
                                            } else {
                                                fiddle();
                                            }
                                5       } elseif ($c == $d) {
                                6           while ($c == $d) {
                                                fiddle();
                                            }
                                7        } elseif ($e == $f) {
                                8           for ($n = 0; $n < $h; $n++) {
                                                fiddle();
                                            }
                                        } else {
                                            switch ($z) {
                                9               case 1:
                                                    fiddle();
                                                    break;
                                10              case 2:
                                                    fiddle();
                                                    break;
                                11              case 3:
                                                    fiddle();
                                                    break;
                                                default:
                                                    fiddle();
                                                    break;
                                            }
                                        }
                                    }
                                }

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

                                The method validatePassword() has a Cyclomatic Complexity of 16. The configured cyclomatic complexity threshold is 10.
                                Open

                                    public function validatePassword($password = false, $username = false) {
                                        
                                        Utility\PasswordUtility::validateParameters($password, $username, $this); 
                                
                                        /**
                                Severity: Minor
                                Found in lib/Users/User.php by phpmd

                                CyclomaticComplexity

                                Since: 0.1

                                Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

                                Example

                                // Cyclomatic Complexity = 11
                                class Foo {
                                1   public function example() {
                                2       if ($a == $b) {
                                3           if ($a1 == $b1) {
                                                fiddle();
                                4           } elseif ($a2 == $b2) {
                                                fiddle();
                                            } else {
                                                fiddle();
                                            }
                                5       } elseif ($c == $d) {
                                6           while ($c == $d) {
                                                fiddle();
                                            }
                                7        } elseif ($e == $f) {
                                8           for ($n = 0; $n < $h; $n++) {
                                                fiddle();
                                            }
                                        } else {
                                            switch ($z) {
                                9               case 1:
                                                    fiddle();
                                                    break;
                                10              case 2:
                                                    fiddle();
                                                    break;
                                11              case 3:
                                                    fiddle();
                                                    break;
                                                default:
                                                    fiddle();
                                                    break;
                                            }
                                        }
                                    }
                                }

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

                                The class User has a coupling between objects value of 18. Consider to reduce the number of dependencies under 13.
                                Open

                                class User extends Base {
                                
                                    /**
                                     * Registry cache key
                                     * @since Version 3.9.1
                                Severity: Minor
                                Found in lib/Users/User.php by phpmd

                                CouplingBetweenObjects

                                Since: 1.1.0

                                A class with too many dependencies has negative impacts on several quality aspects of a class. This includes quality criteria like stability, maintainability and understandability

                                Example

                                class Foo {
                                    /**
                                     * @var \foo\bar\X
                                     */
                                    private $x = null;
                                
                                    /**
                                     * @var \foo\bar\Y
                                     */
                                    private $y = null;
                                
                                    /**
                                     * @var \foo\bar\Z
                                     */
                                    private $z = null;
                                
                                    public function setFoo(\Foo $foo) {}
                                    public function setBar(\Bar $bar) {}
                                    public function setBaz(\Baz $baz) {}
                                
                                    /**
                                     * @return \SplObjectStorage
                                     * @throws \OutOfRangeException
                                     * @throws \InvalidArgumentException
                                     * @throws \ErrorException
                                     */
                                    public function process(\Iterator $it) {}
                                
                                    // ...
                                }

                                Source https://phpmd.org/rules/design.html#couplingbetweenobjects

                                The method getPreferences has a boolean flag argument $section, which is a certain sign of a Single Responsibility Principle violation.
                                Open

                                    public function getPreferences($section = false) {
                                Severity: Minor
                                Found in lib/Users/User.php by phpmd

                                BooleanArgumentFlag

                                Since: 1.4.0

                                A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

                                Example

                                class Foo {
                                    public function bar($flag = true) {
                                    }
                                }

                                Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

                                Remove error control operator '@' on line 1843.
                                Open

                                    public function newAPIKey() {
                                
                                        $len = 32;
                                
                                        if (@is_readable('/dev/urandom')) {
                                Severity: Minor
                                Found in lib/Users/User.php by phpmd

                                ErrorControlOperator

                                Error suppression should be avoided if possible as it doesn't just suppress the error, that you are trying to stop, but will also suppress errors that you didn't predict would ever occur. Consider changing error_reporting() level and/or setting up your own error handler.

                                Example

                                function foo($filePath) {
                                    $file = @fopen($filPath); // hides exceptions
                                    $key = @$array[$notExistingKey]; // assigns null to $key
                                }

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

                                The method validate has a boolean flag argument $ignore, which is a certain sign of a Single Responsibility Principle violation.
                                Open

                                    public function validate($ignore = false) {
                                Severity: Minor
                                Found in lib/Users/User.php by phpmd

                                BooleanArgumentFlag

                                Since: 1.4.0

                                A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

                                Example

                                class Foo {
                                    public function bar($flag = true) {
                                    }
                                }

                                Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

                                The method recordLogin has a boolean flag argument $clientAddr, which is a certain sign of a Single Responsibility Principle violation.
                                Open

                                    public function recordLogin($clientAddr = false) {
                                Severity: Minor
                                Found in lib/Users/User.php by phpmd

                                BooleanArgumentFlag

                                Since: 1.4.0

                                A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

                                Example

                                class Foo {
                                    public function bar($flag = true) {
                                    }
                                }

                                Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

                                The method inGroup has a boolean flag argument $groupId, which is a certain sign of a Single Responsibility Principle violation.
                                Open

                                    public function inGroup($groupId = false) {
                                Severity: Minor
                                Found in lib/Users/User.php by phpmd

                                BooleanArgumentFlag

                                Since: 1.4.0

                                A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

                                Example

                                class Foo {
                                    public function bar($flag = true) {
                                    }
                                }

                                Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

                                The method load has a boolean flag argument $userId, which is a certain sign of a Single Responsibility Principle violation.
                                Open

                                    public function load($userId = false) {
                                Severity: Minor
                                Found in lib/Users/User.php by phpmd

                                BooleanArgumentFlag

                                Since: 1.4.0

                                A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

                                Example

                                class Foo {
                                    public function bar($flag = true) {
                                    }
                                }

                                Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

                                The method addNote has a boolean flag argument $text, which is a certain sign of a Single Responsibility Principle violation.
                                Open

                                    public function addNote($text = false, $adminUserId = 0) {
                                Severity: Minor
                                Found in lib/Users/User.php by phpmd

                                BooleanArgumentFlag

                                Since: 1.4.0

                                A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

                                Example

                                class Foo {
                                    public function bar($flag = true) {
                                    }
                                }

                                Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

                                The method getIPs has a boolean flag argument $time, which is a certain sign of a Single Responsibility Principle violation.
                                Open

                                    public function getIPs($time = false) {
                                Severity: Minor
                                Found in lib/Users/User.php by phpmd

                                BooleanArgumentFlag

                                Since: 1.4.0

                                A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

                                Example

                                class Foo {
                                    public function bar($flag = true) {
                                    }
                                }

                                Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

                                The method setUserAccountStatus has a boolean flag argument $status, which is a certain sign of a Single Responsibility Principle violation.
                                Open

                                    public function setUserAccountStatus($status = false) {
                                Severity: Minor
                                Found in lib/Users/User.php by phpmd

                                BooleanArgumentFlag

                                Since: 1.4.0

                                A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

                                Example

                                class Foo {
                                    public function bar($flag = true) {
                                    }
                                }

                                Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

                                The method validateEmail has a boolean flag argument $email, which is a certain sign of a Single Responsibility Principle violation.
                                Open

                                    public function validateEmail($email = false) {
                                Severity: Minor
                                Found in lib/Users/User.php by phpmd

                                BooleanArgumentFlag

                                Since: 1.4.0

                                A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

                                Example

                                class Foo {
                                    public function bar($flag = true) {
                                    }
                                }

                                Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

                                The method commit has a boolean flag argument $force, which is a certain sign of a Single Responsibility Principle violation.
                                Open

                                    public function commit($force = false) {
                                Severity: Minor
                                Found in lib/Users/User.php by phpmd

                                BooleanArgumentFlag

                                Since: 1.4.0

                                A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

                                Example

                                class Foo {
                                    public function bar($flag = true) {
                                    }
                                }

                                Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

                                The method setPassword has a boolean flag argument $password, which is a certain sign of a Single Responsibility Principle violation.
                                Open

                                    public function setPassword($password = false) {
                                Severity: Minor
                                Found in lib/Users/User.php by phpmd

                                BooleanArgumentFlag

                                Since: 1.4.0

                                A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

                                Example

                                class Foo {
                                    public function bar($flag = true) {
                                    }
                                }

                                Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

                                The method safePassword has a boolean flag argument $password, which is a certain sign of a Single Responsibility Principle violation.
                                Open

                                    public function safePassword($password = false) {
                                Severity: Minor
                                Found in lib/Users/User.php by phpmd

                                BooleanArgumentFlag

                                Since: 1.4.0

                                A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

                                Example

                                class Foo {
                                    public function bar($flag = true) {
                                    }
                                }

                                Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

                                The method validatePassword has a boolean flag argument $password, which is a certain sign of a Single Responsibility Principle violation.
                                Open

                                    public function validatePassword($password = false, $username = false) {
                                Severity: Minor
                                Found in lib/Users/User.php by phpmd

                                BooleanArgumentFlag

                                Since: 1.4.0

                                A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

                                Example

                                class Foo {
                                    public function bar($flag = true) {
                                    }
                                }

                                Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

                                The method isUsernameAvailable has a boolean flag argument $username, which is a certain sign of a Single Responsibility Principle violation.
                                Open

                                    public function isUsernameAvailable($username = false) {
                                Severity: Minor
                                Found in lib/Users/User.php by phpmd

                                BooleanArgumentFlag

                                Since: 1.4.0

                                A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

                                Example

                                class Foo {
                                    public function bar($flag = true) {
                                    }
                                }

                                Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

                                The method isEmailAvailable has a boolean flag argument $email, which is a certain sign of a Single Responsibility Principle violation.
                                Open

                                    public function isEmailAvailable($email = false) {
                                Severity: Minor
                                Found in lib/Users/User.php by phpmd

                                BooleanArgumentFlag

                                Since: 1.4.0

                                A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

                                Example

                                class Foo {
                                    public function bar($flag = true) {
                                    }
                                }

                                Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

                                The method validateAvatar has a boolean flag argument $force, which is a certain sign of a Single Responsibility Principle violation.
                                Open

                                    public function validateAvatar($force = false) {
                                Severity: Minor
                                Found in lib/Users/User.php by phpmd

                                BooleanArgumentFlag

                                Since: 1.4.0

                                A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

                                Example

                                class Foo {
                                    public function bar($flag = true) {
                                    }
                                }

                                Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

                                Remove error control operator '@' on line 2636.
                                Open

                                    public function validateAvatar($force = false) {
                                
                                        if (!empty( $this->avatar )) {
                                            if ($force || ( empty( $this->avatar_width ) || empty( $this->avatar_height ) || $this->avatar_width == 0 || $this->avatar_height == 0 )) {
                                                if ($size = @getimagesize($this->avatar)) {
                                Severity: Minor
                                Found in lib/Users/User.php by phpmd

                                ErrorControlOperator

                                Error suppression should be avoided if possible as it doesn't just suppress the error, that you are trying to stop, but will also suppress errors that you didn't predict would ever occur. Consider changing error_reporting() level and/or setting up your own error handler.

                                Example

                                function foo($filePath) {
                                    $file = @fopen($filPath); // hides exceptions
                                    $key = @$array[$notExistingKey]; // assigns null to $key
                                }

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

                                The method validatePassword has a boolean flag argument $username, which is a certain sign of a Single Responsibility Principle violation.
                                Open

                                    public function validatePassword($password = false, $username = false) {
                                Severity: Minor
                                Found in lib/Users/User.php by phpmd

                                BooleanArgumentFlag

                                Since: 1.4.0

                                A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

                                Example

                                class Foo {
                                    public function bar($flag = true) {
                                    }
                                }

                                Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

                                Avoid assigning values to variables in if clauses and the like (line '1028', column '13').
                                Open

                                    public function load($userId = false) {
                                
                                        if (filter_var($userId, FILTER_VALIDATE_INT)) {
                                            $this->id = $userId;
                                        }
                                Severity: Minor
                                Found in lib/Users/User.php by phpmd

                                IfStatementAssignment

                                Since: 2.7.0

                                Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.

                                Example

                                class Foo
                                {
                                    public function bar($flag)
                                    {
                                        if ($foo = 'bar') { // possible typo
                                            // ...
                                        }
                                        if ($baz = 0) { // always false
                                            // ...
                                        }
                                    }
                                }

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

                                Avoid assigning values to variables in if clauses and the like (line '2636', column '21').
                                Open

                                    public function validateAvatar($force = false) {
                                
                                        if (!empty( $this->avatar )) {
                                            if ($force || ( empty( $this->avatar_width ) || empty( $this->avatar_height ) || $this->avatar_width == 0 || $this->avatar_height == 0 )) {
                                                if ($size = @getimagesize($this->avatar)) {
                                Severity: Minor
                                Found in lib/Users/User.php by phpmd

                                IfStatementAssignment

                                Since: 2.7.0

                                Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.

                                Example

                                class Foo
                                {
                                    public function bar($flag)
                                    {
                                        if ($foo = 'bar') { // possible typo
                                            // ...
                                        }
                                        if ($baz = 0) { // always false
                                            // ...
                                        }
                                    }
                                }

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

                                Avoid assigning values to variables in if clauses and the like (line '1661', column '13').
                                Open

                                    public function getAutoLogin() {
                                
                                        $query = "SELECT autologin_id AS id, autologin_token AS token, autologin_time AS date_set, autologin_expire AS date_expire, autologin_last AS date_last, autologin_ip AS ip, autologin_hostname AS hostname FROM nuke_users_autologin WHERE user_id = ? ORDER BY autologin_last DESC";
                                
                                        $autologins = array();
                                Severity: Minor
                                Found in lib/Users/User.php by phpmd

                                IfStatementAssignment

                                Since: 2.7.0

                                Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.

                                Example

                                class Foo
                                {
                                    public function bar($flag)
                                    {
                                        if ($foo = 'bar') { // possible typo
                                            // ...
                                        }
                                        if ($baz = 0) { // always false
                                            // ...
                                        }
                                    }
                                }

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

                                Avoid assigning values to variables in if clauses and the like (line '1767', column '13').
                                Open

                                    public function getLogins($itemsPerPage = 25, $page = 1) {
                                
                                        if (!filter_var($this->id, FILTER_VALIDATE_INT)) {
                                            return false;
                                        }
                                Severity: Minor
                                Found in lib/Users/User.php by phpmd

                                IfStatementAssignment

                                Since: 2.7.0

                                Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.

                                Example

                                class Foo
                                {
                                    public function bar($flag)
                                    {
                                        if ($foo = 'bar') { // possible typo
                                            // ...
                                        }
                                        if ($baz = 0) { // always false
                                            // ...
                                        }
                                    }
                                }

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

                                The method tryAutoLogin uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                                Open

                                        } else {
                                            $cookie = explode(":", base64_decode(filter_input(INPUT_COOKIE, "rp_autologin")));
                                
                                            #printArray($cookie);die;
                                
                                Severity: Minor
                                Found in lib/Users/User.php by phpmd

                                ElseExpression

                                Since: 1.4.0

                                An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                                Example

                                class Foo
                                {
                                    public function bar($flag)
                                    {
                                        if ($flag) {
                                            // one branch
                                        } else {
                                            // another branch
                                        }
                                    }
                                }

                                Source https://phpmd.org/rules/cleancode.html#elseexpression

                                Avoid assigning values to variables in if clauses and the like (line '1495', column '13').
                                Open

                                    public function loadNotes() {
                                
                                        if (!filter_var($this->id, FILTER_VALIDATE_INT)) {
                                            return false;
                                        }
                                Severity: Minor
                                Found in lib/Users/User.php by phpmd

                                IfStatementAssignment

                                Since: 2.7.0

                                Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.

                                Example

                                class Foo
                                {
                                    public function bar($flag)
                                    {
                                        if ($foo = 'bar') { // possible typo
                                            // ...
                                        }
                                        if ($baz = 0) { // always false
                                            // ...
                                        }
                                    }
                                }

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

                                The method tryAutoLogin uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                                Open

                                                } else {
                                                    $client_addr = filter_input(INPUT_SERVER, "REMOTE_ADDR", FILTER_SANITIZE_URL); #$_SERVER['REMOTE_ADDR'];
                                                }
                                Severity: Minor
                                Found in lib/Users/User.php by phpmd

                                ElseExpression

                                Since: 1.4.0

                                An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                                Example

                                class Foo
                                {
                                    public function bar($flag)
                                    {
                                        if ($flag) {
                                            // one branch
                                        } else {
                                            // another branch
                                        }
                                    }
                                }

                                Source https://phpmd.org/rules/cleancode.html#elseexpression

                                Avoid assigning values to variables in if clauses and the like (line '1613', column '17').
                                Open

                                    public function tryAutoLogin() {
                                
                                        if (is_null(filter_input(INPUT_COOKIE, "rp_autologin"))) { #empty($_COOKIE['rp_autologin'])) {
                                            $this->addNote("Autologin attempted but no autologin cookie was found");
                                
                                Severity: Minor
                                Found in lib/Users/User.php by phpmd

                                IfStatementAssignment

                                Since: 2.7.0

                                Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.

                                Example

                                class Foo
                                {
                                    public function bar($flag)
                                    {
                                        if ($foo = 'bar') { // possible typo
                                            // ...
                                        }
                                        if ($baz = 0) { // always false
                                            // ...
                                        }
                                    }
                                }

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

                                Avoid assigning values to variables in if clauses and the like (line '1938', column '31').
                                Open

                                    public function getGroups($force = null) {
                                
                                        if (!filter_var($this->id, FILTER_VALIDATE_INT)) {
                                            return false;
                                        }
                                Severity: Minor
                                Found in lib/Users/User.php by phpmd

                                IfStatementAssignment

                                Since: 2.7.0

                                Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.

                                Example

                                class Foo
                                {
                                    public function bar($flag)
                                    {
                                        if ($foo = 'bar') { // possible typo
                                            // ...
                                        }
                                        if ($baz = 0) { // always false
                                            // ...
                                        }
                                    }
                                }

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

                                Avoid assigning values to variables in if clauses and the like (line '1994', column '14').
                                Open

                                    public function getWatchedThreads($page = 1, $limit = null) {
                                
                                        // Assume Zend_Db
                                
                                        if (!filter_var($limit, FILTER_VALIDATE_INT)) {
                                Severity: Minor
                                Found in lib/Users/User.php by phpmd

                                IfStatementAssignment

                                Since: 2.7.0

                                Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.

                                Example

                                class Foo
                                {
                                    public function bar($flag)
                                    {
                                        if ($foo = 'bar') { // possible typo
                                            // ...
                                        }
                                        if ($baz = 0) { // always false
                                            // ...
                                        }
                                    }
                                }

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

                                The method setAutoLogin uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                                Open

                                        } else {
                                            $clientAddr = filter_input(INPUT_SERVER, "REMOTE_ADDR", FILTER_SANITIZE_URL); #$_SERVER['REMOTE_ADDR'];
                                        }
                                Severity: Minor
                                Found in lib/Users/User.php by phpmd

                                ElseExpression

                                Since: 1.4.0

                                An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                                Example

                                class Foo
                                {
                                    public function bar($flag)
                                    {
                                        if ($flag) {
                                            // one branch
                                        } else {
                                            // another branch
                                        }
                                    }
                                }

                                Source https://phpmd.org/rules/cleancode.html#elseexpression

                                The method newAPIKey uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                                Open

                                            } else {
                                                $rand = 48 + ord($urandom[$i]) % 64;
                                            }
                                Severity: Minor
                                Found in lib/Users/User.php by phpmd

                                ElseExpression

                                Since: 1.4.0

                                An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                                Example

                                class Foo
                                {
                                    public function bar($flag)
                                    {
                                        if ($flag) {
                                            // one branch
                                        } else {
                                            // another branch
                                        }
                                    }
                                }

                                Source https://phpmd.org/rules/cleancode.html#elseexpression

                                The method updateHash uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                                Open

                                            } else {
                                                $this->db->insert("nuke_users_hash", $data);
                                            }
                                Severity: Minor
                                Found in lib/Users/User.php by phpmd

                                ElseExpression

                                Since: 1.4.0

                                An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                                Example

                                class Foo
                                {
                                    public function bar($flag)
                                    {
                                        if ($flag) {
                                            // one branch
                                        } else {
                                            // another branch
                                        }
                                    }
                                }

                                Source https://phpmd.org/rules/cleancode.html#elseexpression

                                Avoid assigning values to variables in if clauses and the like (line '1471', column '13').
                                Open

                                    public function loadWarnings() {
                                
                                        $query = "SELECT w.warn_id AS warning_id, w.user_id, u.username, w.warned_by AS staff_user_id, s.username AS staff_username, w.warn_reason, w.mod_comments AS staff_comments, w.actiontaken AS warn_action, w.warn_date FROM phpbb_warnings AS w LEFT JOIN nuke_users AS u ON u.user_id = w.user_ID LEFT JOIN nuke_users AS s ON s.user_id = w.warned_by WHERE w.user_id = ? ORDER BY w.warn_date";
                                
                                        if ($result = $this->db->fetchAll($query, $this->id)) {
                                Severity: Minor
                                Found in lib/Users/User.php by phpmd

                                IfStatementAssignment

                                Since: 2.7.0

                                Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.

                                Example

                                class Foo
                                {
                                    public function bar($flag)
                                    {
                                        if ($foo = 'bar') { // possible typo
                                            // ...
                                        }
                                        if ($baz = 0) { // always false
                                            // ...
                                        }
                                    }
                                }

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

                                Avoid assigning values to variables in if clauses and the like (line '1946', column '13').
                                Open

                                    public function getGroups($force = null) {
                                
                                        if (!filter_var($this->id, FILTER_VALIDATE_INT)) {
                                            return false;
                                        }
                                Severity: Minor
                                Found in lib/Users/User.php by phpmd

                                IfStatementAssignment

                                Since: 2.7.0

                                Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.

                                Example

                                class Foo
                                {
                                    public function bar($flag)
                                    {
                                        if ($foo = 'bar') { // possible typo
                                            // ...
                                        }
                                        if ($baz = 0) { // always false
                                            // ...
                                        }
                                    }
                                }

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

                                The method commit uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                                Open

                                        } else {
                                            $this->db->insert("nuke_users", $data);
                                            $this->id = $this->db->lastInsertId();
                                            $this->guest = false;
                                
                                Severity: Minor
                                Found in lib/Users/User.php by phpmd

                                ElseExpression

                                Since: 1.4.0

                                An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                                Example

                                class Foo
                                {
                                    public function bar($flag)
                                    {
                                        if ($flag) {
                                            // one branch
                                        } else {
                                            // another branch
                                        }
                                    }
                                }

                                Source https://phpmd.org/rules/cleancode.html#elseexpression

                                Avoid assigning values to variables in if clauses and the like (line '1804', column '13').
                                Open

                                    public function updateHash() {
                                
                                        $cookie = is_null(filter_input(INPUT_COOKIE, "rp_userhash")) ? "" : filter_input(INPUT_COOKIE, "rp_userhash"); # isset($_COOKIE['rp_userhash']) ? $_COOKIE['rp_userhash'] : "";
                                        $hash = array();
                                        $update = false;
                                Severity: Minor
                                Found in lib/Users/User.php by phpmd

                                IfStatementAssignment

                                Since: 2.7.0

                                Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.

                                Example

                                class Foo
                                {
                                    public function bar($flag)
                                    {
                                        if ($foo = 'bar') { // possible typo
                                            // ...
                                        }
                                        if ($baz = 0) { // always false
                                            // ...
                                        }
                                    }
                                }

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

                                The method updateHash uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                                Open

                                            } else {
                                                $data['ip'] = filter_input(INPUT_SERVER, "REMOTE_ADDR", FILTER_SANITIZE_URL);
                                            }
                                Severity: Minor
                                Found in lib/Users/User.php by phpmd

                                ElseExpression

                                Since: 1.4.0

                                An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                                Example

                                class Foo
                                {
                                    public function bar($flag)
                                    {
                                        if ($flag) {
                                            // one branch
                                        } else {
                                            // another branch
                                        }
                                    }
                                }

                                Source https://phpmd.org/rules/cleancode.html#elseexpression

                                The method getPreferences uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                                Open

                                        } else {
                                            $prefs = $defaults;
                                        }
                                Severity: Minor
                                Found in lib/Users/User.php by phpmd

                                ElseExpression

                                Since: 1.4.0

                                An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                                Example

                                class Foo
                                {
                                    public function bar($flag)
                                    {
                                        if ($flag) {
                                            // one branch
                                        } else {
                                            // another branch
                                        }
                                    }
                                }

                                Source https://phpmd.org/rules/cleancode.html#elseexpression

                                The method validatePassword uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                                Open

                                            } else {
                                                $TmpUser->addNote("Login attempt while InvalidAuthTimeout is in effect");
                                                throw new Exception("You've attempted to log in with the wrong password too many times. We've temporarily disabled your account to protect it against hackers. Please try again soon. <a href='/account/resetpassword'>Can't remember your password?</a>");
                                            }
                                Severity: Minor
                                Found in lib/Users/User.php by phpmd

                                ElseExpression

                                Since: 1.4.0

                                An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                                Example

                                class Foo
                                {
                                    public function bar($flag)
                                    {
                                        if ($flag) {
                                            // one branch
                                        } else {
                                            // another branch
                                        }
                                    }
                                }

                                Source https://phpmd.org/rules/cleancode.html#elseexpression

                                The method validateAvatar uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
                                Open

                                                    } else {
                                                        $this->avatar_width = $size[0];
                                                        $this->avatar_height = $size[1];
                                                        $this->avatar_filename = $this->avatar;
                                                    }
                                Severity: Minor
                                Found in lib/Users/User.php by phpmd

                                ElseExpression

                                Since: 1.4.0

                                An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

                                Example

                                class Foo
                                {
                                    public function bar($flag)
                                    {
                                        if ($flag) {
                                            // one branch
                                        } else {
                                            // another branch
                                        }
                                    }
                                }

                                Source https://phpmd.org/rules/cleancode.html#elseexpression

                                Avoid unused local variables such as '$value'.
                                Open

                                        foreach ($this as $key => $value) {
                                Severity: Minor
                                Found in lib/Users/User.php by phpmd

                                UnusedLocalVariable

                                Since: 0.2

                                Detects when a local variable is declared and/or assigned, but not used.

                                Example

                                class Foo {
                                    public function doSomething()
                                    {
                                        $i = 5; // Unused
                                    }
                                }

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

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

                                    public function guest() {
                                
                                        $this->lang = "english";
                                        $this->date_format = "d M Y H:i";
                                        $this->avatar_filename = "blank.png";
                                Severity: Major
                                Found in lib/Users/User.php and 1 other location - About 1 day to fix
                                lib/Chronicle/Provider/Railcams.php on lines 43..78

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

                                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_null(filter_input(INPUT_SERVER, "HTTP_X_FORWARDED_FOR", FILTER_SANITIZE_STRING))) {#!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
                                                    $client_addr = filter_input(INPUT_SERVER, "HTTP_X_FORWARDED_FOR", FILTER_SANITIZE_STRING); #$_SERVER['HTTP_X_FORWARDED_FOR'];
                                                } else {
                                                    $client_addr = filter_input(INPUT_SERVER, "REMOTE_ADDR", FILTER_SANITIZE_URL); #$_SERVER['REMOTE_ADDR'];
                                                }
                                Severity: Major
                                Found in lib/Users/User.php and 1 other location - About 3 hrs to fix
                                lib/Users/User.php on lines 1553..1557

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

                                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_null(filter_input(INPUT_SERVER, "HTTP_X_FORWARDED_FOR", FILTER_SANITIZE_STRING))) {#!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
                                            $clientAddr = filter_input(INPUT_SERVER, "HTTP_X_FORWARDED_FOR", FILTER_SANITIZE_STRING); #$_SERVER['HTTP_X_FORWARDED_FOR'];
                                        } else {
                                            $clientAddr = filter_input(INPUT_SERVER, "REMOTE_ADDR", FILTER_SANITIZE_URL); #$_SERVER['REMOTE_ADDR'];
                                        }
                                Severity: Major
                                Found in lib/Users/User.php and 1 other location - About 3 hrs to fix
                                lib/Users/User.php on lines 1615..1619

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

                                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 isUsernameAvailable($username = false) {
                                
                                        if (!$username && !empty( $this->username )) {
                                            $username = $this->username;
                                        }
                                Severity: Major
                                Found in lib/Users/User.php and 1 other location - About 2 hrs to fix
                                lib/Users/User.php on lines 2538..2549

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

                                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 isEmailAvailable($email = false) {
                                
                                        if (!$email && !empty( $this->contact_email )) {
                                            $email = $this->contact_email;
                                        }
                                Severity: Major
                                Found in lib/Users/User.php and 1 other location - About 2 hrs to fix
                                lib/Users/User.php on lines 2518..2529

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

                                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 chaff($amt = 1) {
                                
                                        if (!filter_var($amt, FILTER_VALIDATE_INT)) {
                                            $amt = 1;
                                        }
                                Severity: Major
                                Found in lib/Users/User.php and 1 other location - About 2 hrs to fix
                                lib/Users/User.php on lines 2076..2087

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

                                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 wheat($amt = 1) {
                                
                                        if (!filter_var($amt, FILTER_VALIDATE_INT)) {
                                            $amt = 1;
                                        }
                                Severity: Major
                                Found in lib/Users/User.php and 1 other location - About 2 hrs to fix
                                lib/Users/User.php on lines 2098..2109

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

                                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 (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
                                            throw new Exception(sprintf("%s is not a valid email address", $email));
                                        }
                                Severity: Major
                                Found in lib/Users/User.php and 1 other location - About 1 hr to fix
                                lib/Railcams/Camera.php on lines 627..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 40.

                                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 ($acl->isAllowed($acl_role, "railpage.gallery.competition", "manage") && $this->id != 2) {
                                            $query['photocomp'] = "SELECT 'Photo comp' AS module, 'Photo comp submission' AS subtitle, '<i class=\"fa fa-camera\"></i>' AS icon, COUNT(*) AS num, '/gallery/comp' AS url, NULL AS extra FROM image_competition_submissions WHERE status = 0";
                                        }
                                Severity: Major
                                Found in lib/Users/User.php and 1 other location - About 1 hr to fix
                                lib/Users/User.php on lines 2737..2739

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

                                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 ($acl->isAllowed($acl_role, "railpage.locos", "edit") && $this->id != 2) {
                                            $query['locos'] = "SELECT 'Locos' AS module, 'Locos correction' AS subtitle, '<i class=\"fa fa-train\"></i>' AS icon, COUNT(*) AS num, '/locos/corrections' AS url, NULL AS extra FROM loco_unit_corrections WHERE status = 0";
                                        }
                                Severity: Major
                                Found in lib/Users/User.php and 1 other location - About 1 hr to fix
                                lib/Users/User.php on lines 2727..2729

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

                                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

                                        $data = array(
                                            "user_id"   => $this->id,
                                            "ip"        => $ipaddr,
                                            "module_id" => $moduleId,
                                            "url"       => $url,
                                Severity: Major
                                Found in lib/Users/User.php and 1 other location - About 1 hr to fix
                                lib/Users/Group.php on lines 310..316

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

                                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

                                        $this->avatar_filename = function_exists("format_avatar") ? format_avatar("http://static.railpage.com.au/modules/Forums/images/avatars/gallery/blank.png", 120, 120) : "http://static.railpage.com.au/modules/Forums/images/avatars/gallery/blank.png";
                                Severity: Major
                                Found in lib/Users/User.php and 1 other location - About 1 hr to fix
                                lib/Users/User.php on lines 2658..2658

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

                                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

                                        $this->avatar = function_exists("format_avatar") ? format_avatar("http://static.railpage.com.au/modules/Forums/images/avatars/gallery/blank.png", 120, 120) : "http://static.railpage.com.au/modules/Forums/images/avatars/gallery/blank.png";
                                Severity: Major
                                Found in lib/Users/User.php and 1 other location - About 1 hr to fix
                                lib/Users/User.php on lines 2659..2659

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

                                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, $this->id) as $row) {
                                            $ips[] = $row['login_ip'];
                                        }
                                Severity: Major
                                Found in lib/Users/User.php and 1 other location - About 1 hr to fix
                                lib/Forums/Thread.php on lines 749..751

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

                                        if (!filter_var($this->id, FILTER_VALIDATE_INT) && !$this->RegistrationDate instanceof DateTime) {
                                            $this->RegistrationDate = new DateTime;
                                        }
                                Severity: Major
                                Found in lib/Users/User.php and 1 other location - About 1 hr to fix
                                lib/Forums/Forum.php on lines 265..267

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

                                        if (!filter_var($this->level, FILTER_VALIDATE_INT)) {
                                            $this->level = 1;
                                        }
                                Severity: Major
                                Found in lib/Users/User.php and 11 other locations - About 1 hr to fix
                                lib/Downloads/Download.php on lines 297..299
                                lib/Downloads/Download.php on lines 301..303
                                lib/Downloads/Download.php on lines 305..307
                                lib/Feedback/FeedbackItem.php on lines 184..186
                                lib/Forums/Category.php on lines 166..168
                                lib/Gallery/Image.php on lines 334..336
                                lib/Ideas/Idea.php on lines 268..270
                                lib/Ideas/Idea.php on lines 272..274
                                lib/Locations/Location.php on lines 440..442
                                lib/Locations/Location.php on lines 452..454
                                lib/Locos/Operator.php on lines 129..131

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

                                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

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

                                        foreach ($data as $key => $val) {
                                            if (is_null($val)) {
                                                $data[$key] = "";
                                            }
                                        }
                                Severity: Major
                                Found in lib/Users/User.php and 1 other location - About 1 hr to fix
                                lib/Locos/LocoClass.php on lines 620..624

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

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

                                        if ($this->RegistrationDate instanceof DateTime) {
                                            $data['user_regdate_nice'] = $this->RegistrationDate->format("Y-m-d H:i:s");
                                        }
                                Severity: Major
                                Found in lib/Users/User.php and 3 other locations - About 1 hr to fix
                                lib/Events/EventDate.php on lines 253..255
                                lib/Events/EventDate.php on lines 257..259
                                lib/Locations/Correction.php on lines 206..208

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

                                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

                                            } else {
                                                $data['ip'] = filter_input(INPUT_SERVER, "REMOTE_ADDR", FILTER_SANITIZE_URL);
                                            }
                                Severity: Major
                                Found in lib/Users/User.php and 1 other location - About 1 hr to fix
                                lib/Users/User.php on lines 1819..1823

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

                                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_null(filter_input(INPUT_SERVER, "HTTP_X_FORWARDED_FOR", FILTER_SANITIZE_STRING))) {
                                                $data['ip'] = filter_input(INPUT_SERVER, "HTTP_X_FORWARDED_FOR", FILTER_SANITIZE_STRING);
                                            } else {
                                                $data['ip'] = filter_input(INPUT_SERVER, "REMOTE_ADDR", FILTER_SANITIZE_URL);
                                            }
                                Severity: Major
                                Found in lib/Users/User.php and 1 other location - About 1 hr to fix
                                lib/Users/User.php on lines 1821..1823

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

                                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 ($clientAddr === false && !is_null(filter_input(INPUT_SERVER, "HTTP_X_FORWARDED_FOR", FILTER_SANITIZE_STRING))) {#!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
                                Severity: Minor
                                Found in lib/Users/User.php and 1 other location - About 1 hr to fix
                                lib/Images/Image.php on lines 718..719

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

                                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 (!filter_var($limit, FILTER_VALIDATE_INT)) {
                                            $limit = $this->items_per_page;
                                        }
                                Severity: Minor
                                Found in lib/Users/User.php and 1 other location - About 55 mins to fix
                                lib/Locos/LocoClass.php on lines 698..700

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

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

                                        if (!filter_var($this->id, FILTER_VALIDATE_INT)) {
                                            return false;
                                        }
                                Severity: Major
                                Found in lib/Users/User.php and 13 other locations - About 55 mins to fix
                                lib/Forums/Thread.php on lines 763..765
                                lib/Images/Competition.php on lines 536..538
                                lib/Images/Competition.php on lines 588..590
                                lib/Images/Screener.php on lines 363..365
                                lib/Links/Link.php on lines 108..110
                                lib/Links/Link.php on lines 210..212
                                lib/Links/Link.php on lines 230..232
                                lib/Users/User.php on lines 1009..1011
                                lib/Users/User.php on lines 1489..1491
                                lib/Users/User.php on lines 1520..1522
                                lib/Users/User.php on lines 1682..1684
                                lib/Users/User.php on lines 1708..1710
                                lib/Users/User.php on lines 1930..1932

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

                                        if (!filter_var($this->id, FILTER_VALIDATE_INT)) {
                                            return false;
                                        }
                                Severity: Major
                                Found in lib/Users/User.php and 13 other locations - About 55 mins to fix
                                lib/Forums/Thread.php on lines 763..765
                                lib/Images/Competition.php on lines 536..538
                                lib/Images/Competition.php on lines 588..590
                                lib/Images/Screener.php on lines 363..365
                                lib/Links/Link.php on lines 108..110
                                lib/Links/Link.php on lines 210..212
                                lib/Links/Link.php on lines 230..232
                                lib/Users/User.php on lines 1009..1011
                                lib/Users/User.php on lines 1489..1491
                                lib/Users/User.php on lines 1682..1684
                                lib/Users/User.php on lines 1708..1710
                                lib/Users/User.php on lines 1751..1753
                                lib/Users/User.php on lines 1930..1932

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

                                        if (!filter_var($this->id, FILTER_VALIDATE_INT)) {
                                            return false;
                                        }
                                Severity: Major
                                Found in lib/Users/User.php and 13 other locations - About 55 mins to fix
                                lib/Forums/Thread.php on lines 763..765
                                lib/Images/Competition.php on lines 536..538
                                lib/Images/Competition.php on lines 588..590
                                lib/Images/Screener.php on lines 363..365
                                lib/Links/Link.php on lines 108..110
                                lib/Links/Link.php on lines 210..212
                                lib/Links/Link.php on lines 230..232
                                lib/Users/User.php on lines 1009..1011
                                lib/Users/User.php on lines 1489..1491
                                lib/Users/User.php on lines 1520..1522
                                lib/Users/User.php on lines 1682..1684
                                lib/Users/User.php on lines 1708..1710
                                lib/Users/User.php on lines 1751..1753

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

                                        if (!filter_var($this->id, FILTER_VALIDATE_INT)) {
                                            return false;
                                        }
                                Severity: Major
                                Found in lib/Users/User.php and 13 other locations - About 55 mins to fix
                                lib/Forums/Thread.php on lines 763..765
                                lib/Images/Competition.php on lines 536..538
                                lib/Images/Competition.php on lines 588..590
                                lib/Images/Screener.php on lines 363..365
                                lib/Links/Link.php on lines 108..110
                                lib/Links/Link.php on lines 210..212
                                lib/Links/Link.php on lines 230..232
                                lib/Users/User.php on lines 1009..1011
                                lib/Users/User.php on lines 1489..1491
                                lib/Users/User.php on lines 1520..1522
                                lib/Users/User.php on lines 1708..1710
                                lib/Users/User.php on lines 1751..1753
                                lib/Users/User.php on lines 1930..1932

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

                                        if (!filter_var($this->id, FILTER_VALIDATE_INT)) {
                                            return false;
                                        }
                                Severity: Major
                                Found in lib/Users/User.php and 13 other locations - About 55 mins to fix
                                lib/Forums/Thread.php on lines 763..765
                                lib/Images/Competition.php on lines 536..538
                                lib/Images/Competition.php on lines 588..590
                                lib/Images/Screener.php on lines 363..365
                                lib/Links/Link.php on lines 108..110
                                lib/Links/Link.php on lines 210..212
                                lib/Links/Link.php on lines 230..232
                                lib/Users/User.php on lines 1489..1491
                                lib/Users/User.php on lines 1520..1522
                                lib/Users/User.php on lines 1682..1684
                                lib/Users/User.php on lines 1708..1710
                                lib/Users/User.php on lines 1751..1753
                                lib/Users/User.php on lines 1930..1932

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

                                        if (!filter_var($this->id, FILTER_VALIDATE_INT)) {
                                            return false;
                                        }
                                Severity: Major
                                Found in lib/Users/User.php and 13 other locations - About 55 mins to fix
                                lib/Forums/Thread.php on lines 763..765
                                lib/Images/Competition.php on lines 536..538
                                lib/Images/Competition.php on lines 588..590
                                lib/Images/Screener.php on lines 363..365
                                lib/Links/Link.php on lines 108..110
                                lib/Links/Link.php on lines 210..212
                                lib/Links/Link.php on lines 230..232
                                lib/Users/User.php on lines 1009..1011
                                lib/Users/User.php on lines 1520..1522
                                lib/Users/User.php on lines 1682..1684
                                lib/Users/User.php on lines 1708..1710
                                lib/Users/User.php on lines 1751..1753
                                lib/Users/User.php on lines 1930..1932

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

                                        if (!filter_var($this->id, FILTER_VALIDATE_INT)) {
                                            return false;
                                        }
                                Severity: Major
                                Found in lib/Users/User.php and 13 other locations - About 55 mins to fix
                                lib/Forums/Thread.php on lines 763..765
                                lib/Images/Competition.php on lines 536..538
                                lib/Images/Competition.php on lines 588..590
                                lib/Images/Screener.php on lines 363..365
                                lib/Links/Link.php on lines 108..110
                                lib/Links/Link.php on lines 210..212
                                lib/Links/Link.php on lines 230..232
                                lib/Users/User.php on lines 1009..1011
                                lib/Users/User.php on lines 1489..1491
                                lib/Users/User.php on lines 1520..1522
                                lib/Users/User.php on lines 1682..1684
                                lib/Users/User.php on lines 1751..1753
                                lib/Users/User.php on lines 1930..1932

                                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 (defined("RP_GROUP_ADMINS") && $this->inGroup(RP_GROUP_ADMINS)) {
                                            return "administrator";
                                        }
                                Severity: Minor
                                Found in lib/Users/User.php and 1 other location - About 55 mins to fix
                                lib/Users/User.php on lines 2052..2054

                                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 (defined("RP_GROUP_MODERATORS") && $this->inGroup(RP_GROUP_MODERATORS)) {
                                            return "moderator";
                                        }
                                Severity: Minor
                                Found in lib/Users/User.php and 1 other location - About 55 mins to fix
                                lib/Users/User.php on lines 2048..2050

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

                                        if (!defined("RP_GROUP_ADMINS")) {
                                            define("RP_GROUP_ADMINS", "michaelisawesome");
                                        }
                                Severity: Major
                                Found in lib/Users/User.php and 7 other locations - About 50 mins to fix
                                lib/Formatting/MultimediaUtility.php on lines 27..29
                                lib/AppCore.php on lines 38..40
                                lib/AppCore.php on lines 42..44
                                lib/AppCore.php on lines 46..48
                                lib/Module.php on lines 18..20
                                lib/Session.php on lines 70..72
                                lib/Template_Cache_Memcache.php on lines 17..19

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

                                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

                                        Debug::LogEvent(__METHOD__ . "(" . $this->id . ")", $timer);
                                Severity: Major
                                Found in lib/Users/User.php and 2 other locations - About 50 mins to fix
                                lib/Users/User.php on lines 1031..1031
                                lib/Users/User.php on lines 1043..1043

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

                                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

                                            Debug::logEvent(__METHOD__ . "(" . $this->id . ") loaded via ZendDB", $timer);
                                Severity: Major
                                Found in lib/Users/User.php and 2 other locations - About 50 mins to fix
                                lib/Users/User.php on lines 990..990
                                lib/Users/User.php on lines 1031..1031

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

                                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

                                        $result = $this->db->fetchAll($query, array( $email, $this->id ));
                                Severity: Major
                                Found in lib/Users/User.php and 2 other locations - About 50 mins to fix
                                lib/Locos/Locomotive.php on lines 960..960
                                lib/Railcams/Camera.php on lines 863..863

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

                                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

                                            Debug::logEvent(__METHOD__ . "(" . $this->id . ") loaded via Redis", $timer);
                                Severity: Major
                                Found in lib/Users/User.php and 2 other locations - About 50 mins to fix
                                lib/Users/User.php on lines 990..990
                                lib/Users/User.php on lines 1043..1043

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

                                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

                                        $args = array(
                                            $this->id,
                                            ( $page - 1 ) * $itemsPerPage,
                                            $itemsPerPage
                                        );
                                Severity: Minor
                                Found in lib/Users/User.php and 1 other location - About 50 mins to fix
                                lib/Forums/Forum.php on lines 497..501

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

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

                                        $this->meta = json_decode($data['meta'], true);
                                Severity: Major
                                Found in lib/Users/User.php and 22 other locations - About 45 mins to fix
                                lib/Assets/Asset.php on lines 150..150
                                lib/Chronicle/Entry.php on lines 156..156
                                lib/Events/Event.php on lines 207..207
                                lib/Events/EventDate.php on lines 154..154
                                lib/Gallery/Album.php on lines 136..136
                                lib/Gallery/Image.php on lines 208..208
                                lib/Ideas/Idea.php on lines 166..166
                                lib/Images/Camera.php on lines 116..116
                                lib/Images/Competition.php on lines 180..180
                                lib/Images/Competition.php on lines 790..790
                                lib/Locos/Date.php on lines 158..158
                                lib/Locos/LocoClass.php on lines 417..417
                                lib/News/Feed.php on lines 234..234
                                lib/News/Feed.php on lines 235..235
                                lib/Newsletters/Newsletter.php on lines 128..128
                                lib/Newsletters/Newsletter.php on lines 129..129
                                lib/Railcams/Storage.php on lines 201..201
                                lib/Sightings/Sighting.php on lines 161..161
                                lib/Sightings/Sighting.php on lines 162..162
                                lib/Timetables/Train.php on lines 174..174
                                lib/Users/Group.php on lines 168..168
                                lib/SiteEvent.php on lines 135..135

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

                                        if (filter_var($this->id, FILTER_VALIDATE_INT)) {
                                            $this->load();
                                        }
                                Severity: Major
                                Found in lib/Users/User.php and 4 other locations - About 45 mins to fix
                                lib/Glossary/Entry.php on lines 211..213
                                lib/Locations/Location.php on lines 296..298
                                lib/Locos/Locomotive.php on lines 347..349
                                lib/Users/User.php on lines 984..986

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

                                                if (filter_var($this->id, FILTER_VALIDATE_INT)) {
                                                    $this->load();
                                                }
                                Severity: Major
                                Found in lib/Users/User.php and 4 other locations - About 45 mins to fix
                                lib/Glossary/Entry.php on lines 211..213
                                lib/Locations/Location.php on lines 296..298
                                lib/Locos/Locomotive.php on lines 347..349
                                lib/Users/User.php on lines 2368..2370

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

                                            if (!is_array($this->meta)) {
                                                $this->meta = array();
                                            }
                                Severity: Major
                                Found in lib/Users/User.php and 2 other locations - About 45 mins to fix
                                lib/Ideas/Idea.php on lines 168..170
                                lib/Notifications/Notification.php on lines 160..162

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

                                        if (filter_var($this->id, FILTER_VALIDATE_INT)) {
                                            $this->db->update("nuke_users", $data, array( "user_id = ?" => $this->id ));
                                        } else {
                                            $this->db->insert("nuke_users", $data);
                                            $this->id = $this->db->lastInsertId();
                                Severity: Minor
                                Found in lib/Users/User.php and 1 other location - About 45 mins to fix
                                lib/Users/User.php on lines 1825..1829

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

                                            if ($update) {
                                                $this->db->update("nuke_users_hash", $data, array( "user_id = ?" => $this->id ));
                                            } else {
                                                $this->db->insert("nuke_users_hash", $data);
                                            }
                                Severity: Minor
                                Found in lib/Users/User.php and 1 other location - About 45 mins to fix
                                lib/Users/User.php on lines 1268..1276

                                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

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

                                        if (!filter_var($this->id, FILTER_VALIDATE_INT)) {
                                            return $this;
                                        }
                                Severity: Minor
                                Found in lib/Users/User.php and 1 other location - About 45 mins to fix
                                lib/Users/User.php on lines 1410..1412

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

                                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

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

                                        if (!filter_var($this->id, FILTER_VALIDATE_INT)) {
                                            return $this;
                                        }
                                Severity: Minor
                                Found in lib/Users/User.php and 1 other location - About 45 mins to fix
                                lib/Users/User.php on lines 1438..1440

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

                                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 ($result = $this->db->fetchAll($query, intval($this->id))) {
                                Severity: Minor
                                Found in lib/Users/User.php and 1 other location - About 45 mins to fix
                                lib/Locations/Country.php on lines 176..176

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

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

                                            "server"         => filter_input(INPUT_SERVER, "HTTP_HOST", FILTER_SANITIZE_STRING)
                                Severity: Major
                                Found in lib/Users/User.php and 3 other locations - About 40 mins to fix
                                lib/Users/User.php on lines 1564..1564
                                lib/Users/User.php on lines 1624..1624
                                lib/Users/User.php on lines 1722..1722

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

                                            } elseif (is_string($arg) && strlen($arg) > 1) {
                                                $query = "SELECT user_id FROM nuke_users WHERE username = ?";
                                                $this->id = $this->db->fetchOne($query, $arg);
                                
                                                if (filter_var($this->id, FILTER_VALIDATE_INT)) {
                                Severity: Major
                                Found in lib/Users/User.php and 4 other locations - About 40 mins to fix
                                lib/Content/Page.php on lines 113..117
                                lib/Events/EventCategory.php on lines 99..101
                                lib/Ideas/Category.php on lines 80..91
                                lib/Ideas/Idea.php on lines 136..138

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

                                            $this->meta = json_decode($this->meta, true);
                                Severity: Major
                                Found in lib/Users/User.php and 3 other locations - About 40 mins to fix
                                lib/Forums/Category.php on lines 160..160
                                lib/Jobs/Job.php on lines 260..260
                                lib/Users/User.php on lines 2889..2889

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

                                            "login_hostname" => filter_input(INPUT_SERVER, "HTTP_HOST", FILTER_SANITIZE_STRING),
                                Severity: Major
                                Found in lib/Users/User.php and 3 other locations - About 40 mins to fix
                                lib/Users/User.php on lines 1564..1564
                                lib/Users/User.php on lines 1624..1624
                                lib/Users/User.php on lines 1723..1723

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

                                            $this->meta = json_decode($this->meta, true);
                                Severity: Major
                                Found in lib/Users/User.php and 3 other locations - About 40 mins to fix
                                lib/Forums/Category.php on lines 160..160
                                lib/Jobs/Job.php on lines 260..260
                                lib/Users/User.php on lines 2912..2912

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

                                            "autologin_hostname" => filter_input(INPUT_SERVER, "REMOTE_HOST", FILTER_SANITIZE_STRING),
                                Severity: Major
                                Found in lib/Users/User.php and 3 other locations - About 40 mins to fix
                                lib/Users/User.php on lines 1624..1624
                                lib/Users/User.php on lines 1722..1722
                                lib/Users/User.php on lines 1723..1723

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

                                                    "autologin_hostname" => filter_input(INPUT_SERVER, "REMOTE_HOST", FILTER_SANITIZE_STRING),
                                Severity: Major
                                Found in lib/Users/User.php and 3 other locations - About 40 mins to fix
                                lib/Users/User.php on lines 1564..1564
                                lib/Users/User.php on lines 1722..1722
                                lib/Users/User.php on lines 1723..1723

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

                                        if (isset( $data['password_new'] )) {
                                            $this->password_new = $data['password_new'];
                                        }
                                Severity: Major
                                Found in lib/Users/User.php and 2 other locations - About 40 mins to fix
                                lib/Locations/Region.php on lines 164..166
                                lib/Locos/LocoClass.php on lines 366..368

                                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

                                                $this->lastvisit = $logins[key($logins)]['login_time'];
                                Severity: Minor
                                Found in lib/Users/User.php and 1 other location - About 40 mins to fix
                                lib/Users/User.php on lines 1774..1774

                                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

                                        if ($time instanceof DateTime) {
                                            $query .= " AND login_time >= " . $time->getTimestamp();
                                        }
                                Severity: Minor
                                Found in lib/Users/User.php and 1 other location - About 40 mins to fix
                                lib/Users/User.php on lines 2483..2485

                                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

                                            $this->session_ip = $logins[key($logins)]['login_ip'];
                                Severity: Minor
                                Found in lib/Users/User.php and 1 other location - About 40 mins to fix
                                lib/Users/User.php on lines 1777..1777

                                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

                                        if ($time instanceof DateTime) {
                                            $query .= " AND post_time >= " . $time->getTimestamp();
                                        }
                                Severity: Minor
                                Found in lib/Users/User.php and 1 other location - About 40 mins to fix
                                lib/Users/User.php on lines 2497..2499

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

                                        if (!$email || empty( $email )) {
                                            throw new Exception("No email address was supplied.");
                                        }
                                Severity: Major
                                Found in lib/Users/User.php and 5 other locations - About 40 mins to fix
                                lib/Locos/Locomotive.php on lines 712..714
                                lib/Notifications/Notification.php on lines 474..476
                                lib/Timetables/Train.php on lines 264..266
                                lib/Timetables/Train.php on lines 268..270
                                lib/Users/User.php on lines 2136..2138

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

                                        if (!$password || empty( $password )) {
                                            throw new Exception("Cannot set password - no password was provided");
                                        }
                                Severity: Major
                                Found in lib/Users/User.php and 5 other locations - About 40 mins to fix
                                lib/Locos/Locomotive.php on lines 712..714
                                lib/Notifications/Notification.php on lines 474..476
                                lib/Timetables/Train.php on lines 264..266
                                lib/Timetables/Train.php on lines 268..270
                                lib/Users/User.php on lines 2446..2448

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

                                            if (!$this->isUsernameAvailable()) {
                                                throw new Exception(sprintf("The desired username %s is already in use", $this->username));
                                            }
                                Severity: Minor
                                Found in lib/Users/User.php and 2 other locations - About 40 mins to fix
                                lib/News/Article.php on lines 460..462
                                lib/Users/User.php on lines 1212..1214

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

                                        if (!filter_var($this->contact_email, FILTER_VALIDATE_EMAIL)) {
                                            throw new Exception(sprintf("%s is not a valid email address", $this->contact_email));
                                        }
                                Severity: Minor
                                Found in lib/Users/User.php and 2 other locations - About 40 mins to fix
                                lib/News/Article.php on lines 460..462
                                lib/Users/User.php on lines 1225..1227

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

                                        $prefs = is_object($this->preferences) ? json_decode(json_encode($this->preferences), true) : $this->preferences;
                                Severity: Minor
                                Found in lib/Users/User.php and 2 other locations - About 40 mins to fix
                                lib/News/Scraper.php on lines 179..179
                                lib/Notifications/Notification.php on lines 368..368

                                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

                                        foreach ($fields as $key => $var) {
                                            $this->$var = $data[$key];
                                        }
                                Severity: Minor
                                Found in lib/Users/User.php and 1 other location - About 40 mins to fix
                                lib/Organisations/Organisation.php on lines 236..238

                                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

                                                $this->db->update("nuke_users_autologin", $data, array( "autologin_id = ?" => $autologin_id ));
                                Severity: Minor
                                Found in lib/Users/User.php and 1 other location - About 40 mins to fix
                                lib/News/Feed.php on lines 267..267

                                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

                                        $this->session_last_nice = date($this->date_format, $this->lastvisit);
                                Severity: Minor
                                Found in lib/Users/User.php and 1 other location - About 40 mins to fix
                                lib/Images/Collage.php on lines 267..267

                                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

                                        if ($data['login_ip'] == $data['login_hostname']) {
                                            $data['login_hostname'] = gethostbyaddr($data['login_ip']);
                                        }
                                Severity: Minor
                                Found in lib/Users/User.php and 1 other location - About 40 mins to fix
                                lib/Images/Competitions.php on lines 310..312

                                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

                                        if (!isset( $this->meta['captchaTimestamp'] ) || empty( $this->meta['captchaTimestamp'] ) || $this->meta['captchaTimestamp'] - self::HUMAN_VALIDATION_TTL <= time()) {
                                Severity: Minor
                                Found in lib/Users/User.php and 1 other location - About 40 mins to fix
                                lib/Events/Event.php on lines 572..572

                                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

                                        foreach ($json as $key) {
                                            $data[$key] = json_encode($data[$key]);
                                        }
                                Severity: Minor
                                Found in lib/Users/User.php and 1 other location - About 40 mins to fix
                                lib/SocketIO.php on lines 146..148

                                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($url)) {
                                            throw new Exception("Cannot log user activity because no URL was provided");
                                        }
                                Severity: Major
                                Found in lib/Users/User.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/Locos/Locos.php on lines 925..927
                                lib/Railcams/Storage/LocalFS.php on lines 127..129
                                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($pagetitle)) {
                                            throw new Exception("Cannot log user activity because no pagetitle was provided");
                                        }
                                Severity: Major
                                Found in lib/Users/User.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/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 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($ipaddr)) {
                                            throw new Exception("Cannot log user activity because no remote IP was provided");
                                        }
                                Severity: Major
                                Found in lib/Users/User.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/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/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 8 locations. Consider refactoring.
                                Open

                                        $regkey = sprintf(self::REGISTRY_KEY, $this->id);
                                Severity: Major
                                Found in lib/Users/User.php and 7 other locations - About 35 mins to fix
                                lib/Forums/Post.php on lines 626..626
                                lib/Forums/Post.php on lines 660..660
                                lib/Images/Camera.php on lines 207..207
                                lib/Images/Competition.php on lines 338..338
                                lib/Locos/LocoClass.php on lines 657..657
                                lib/Locos/Locomotive.php on lines 692..692
                                lib/Locos/Locomotive.php on lines 1498..1498

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

                                            if (isset( $this->meta['InvalidAuthTimeout'] )) {
                                                unset( $this->meta['InvalidAuthTimeout'] );
                                            }
                                Severity: Major
                                Found in lib/Users/User.php and 3 other locations - About 35 mins to fix
                                lib/Locos/LocoClass.php on lines 1139..1141
                                lib/Locos/Locomotive.php on lines 1332..1334
                                lib/Users/User.php on lines 2249..2251

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

                                            if (isset( $this->meta['InvalidAuthCounter'] )) {
                                                unset( $this->meta['InvalidAuthCounter'] );
                                            }
                                Severity: Major
                                Found in lib/Users/User.php and 3 other locations - About 35 mins to fix
                                lib/Locos/LocoClass.php on lines 1139..1141
                                lib/Locos/Locomotive.php on lines 1332..1334
                                lib/Users/User.php on lines 2253..2255

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

                                        $cookie = is_null(filter_input(INPUT_COOKIE, "rp_userhash")) ? "" : filter_input(INPUT_COOKIE, "rp_userhash"); # isset($_COOKIE['rp_userhash']) ? $_COOKIE['rp_userhash'] : "";
                                Severity: Minor
                                Found in lib/Users/User.php and 1 other location - About 35 mins to fix
                                lib/Users/User.php on lines 1598..1645

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

                                        if ((boolean)$this->active === false) {
                                            return self::STATUS_UNACTIVATED;
                                        }
                                Severity: Minor
                                Found in lib/Users/User.php and 1 other location - About 35 mins to fix
                                lib/Users/User.php on lines 2310..2312

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

                                        if ($result = $this->db->fetchAll($query, $args)) {
                                            foreach ($result as $row) {
                                                $logins[$row['login_id']] = $row;
                                            }
                                        }
                                Severity: Minor
                                Found in lib/Users/User.php and 1 other location - About 35 mins to fix
                                lib/Users/User.php on lines 1661..1665

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

                                        if ((boolean)$this->active === true) {
                                            return self::STATUS_ACTIVE;
                                        }
                                Severity: Minor
                                Found in lib/Users/User.php and 1 other location - About 35 mins to fix
                                lib/Users/User.php on lines 2321..2323

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

                                        if ($text == false || is_null(filter_var($text, FILTER_SANITIZE_STRING))) {
                                Severity: Minor
                                Found in lib/Users/User.php and 1 other location - About 35 mins to fix
                                lib/Users/User.php on lines 2403..2403

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

                                        if (empty( $password ) || is_null(filter_var($password, FILTER_SANITIZE_STRING))) {
                                Severity: Minor
                                Found in lib/Users/User.php and 1 other location - About 35 mins to fix
                                lib/Users/User.php on lines 1524..1524

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

                                        if (strlen($password) < 7) {
                                            return false;
                                        }
                                Severity: Minor
                                Found in lib/Users/User.php and 1 other location - About 35 mins to fix
                                lib/Users/User.php on lines 1607..1609

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

                                        if (is_null(filter_input(INPUT_COOKIE, "rp_autologin"))) { #empty($_COOKIE['rp_autologin'])) {
                                            $this->addNote("Autologin attempted but no autologin cookie was found");
                                
                                            return false;
                                        } else {
                                Severity: Minor
                                Found in lib/Users/User.php and 1 other location - About 35 mins to fix
                                lib/Users/User.php on lines 1793..1793

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

                                            if (count($cookie) < 2) {
                                                return false;
                                            }
                                Severity: Minor
                                Found in lib/Users/User.php and 1 other location - About 35 mins to fix
                                lib/Users/User.php on lines 2407..2409

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

                                        if ($result = $this->db->fetchAll($query, $this->id)) {
                                            foreach ($result as $row) {
                                                $autologins[$row['id']] = $row;
                                            }
                                        }
                                Severity: Minor
                                Found in lib/Users/User.php and 1 other location - About 35 mins to fix
                                lib/Users/User.php on lines 1767..1771

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

                                        if (is_null($remoteAddr)) {
                                            $this->session_ip = $remoteAddr;
                                        }
                                Severity: Major
                                Found in lib/Users/User.php and 5 other locations - About 30 mins to fix
                                lib/GTFS/StandardRoute.php on lines 60..62
                                lib/Jobs/Scraper.php on lines 73..75
                                lib/Jobs/Scraper.php on lines 77..79
                                lib/News/Scraper.php on lines 70..72
                                lib/News/Scraper.php on lines 74..76

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

                                        if (empty( $this->default_theme )) {
                                            $this->default_theme = self::DEFAULT_THEME;
                                        }
                                Severity: Minor
                                Found in lib/Users/User.php and 2 other locations - About 30 mins to fix
                                lib/Chronicle/Entry.php on lines 216..218
                                lib/Chronicle/EntryType.php on lines 107..109

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

                                        if (in_array($password, $bad)) {
                                            return false;
                                        }
                                Severity: Minor
                                Found in lib/Users/User.php and 2 other locations - About 30 mins to fix
                                lib/Users/Utility/PasswordUtility.php on lines 86..88
                                lib/Users/Utility/PasswordUtility.php on lines 90..92

                                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 (is_string($prefs)) {
                                            $prefs = json_decode($prefs, true);
                                        }
                                Severity: Minor
                                Found in lib/Users/User.php and 1 other location - About 30 mins to fix
                                lib/Place.php on lines 641..643

                                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

                                        foreach ($this->db->fetchAll($query, $this->id) as $row) {
                                            $ips[] = decode_ip($row['poster_ip']);
                                        }
                                Severity: Minor
                                Found in lib/Users/User.php and 1 other location - About 30 mins to fix
                                lib/News/Feed.php on lines 113..115

                                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

                                Identical blocks of code found in 3 locations. Consider refactoring.
                                Open

                                                try {
                                                    $this->id = $cookie[0];
                                                    $this->recordLogin();
                                                } catch (Exception $e) {
                                                    global $Error;
                                Severity: Minor
                                Found in lib/Users/User.php and 2 other locations - About 30 mins to fix
                                lib/Locos/LocoClass.php on lines 425..430
                                lib/Locos/Locomotive.php on lines 761..771

                                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

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

                                        $this->preferences = json_decode($data['user_opts']);
                                Severity: Major
                                Found in lib/Users/User.php and 7 other locations - About 30 mins to fix
                                lib/Forums/Post.php on lines 314..314
                                lib/Forums/Post.php on lines 315..315
                                lib/Images/Competition.php on lines 420..420
                                lib/Locations/Date.php on lines 71..71
                                lib/Locations/Location.php on lines 498..498
                                lib/Notifications/Notification.php on lines 135..135
                                lib/PrivateMessages/Message.php on lines 275..275

                                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

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

                                        $this->meta['captchaTimestamp'] = strtotime("+24 hours");
                                Severity: Minor
                                Found in lib/Users/User.php and 1 other location - About 30 mins to fix
                                lib/Users/User.php on lines 2273..2273

                                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

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

                                            case self::STATUS_ACTIVE :
                                                $this->active = true;
                                                break;
                                Severity: Minor
                                Found in lib/Users/User.php and 1 other location - About 30 mins to fix
                                lib/Users/User.php on lines 2349..2351

                                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

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

                                            setcookie("rp_autologin", base64_encode(implode(":", $autologin)), $cookieExpire, RP_AUTOLOGIN_PATH, RP_AUTOLOGIN_DOMAIN, RP_SSL_ENABLED, true);
                                Severity: Minor
                                Found in lib/Users/User.php and 1 other location - About 30 mins to fix
                                lib/BanControl/LookupUtility.php on lines 137..137

                                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

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

                                            $TmpUser->meta['InvalidAuthTimeout'] = strtotime("+10 minutes");
                                Severity: Minor
                                Found in lib/Users/User.php and 1 other location - About 30 mins to fix
                                lib/Users/User.php on lines 2918..2918

                                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

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

                                            case self::STATUS_UNACTIVATED :
                                                $this->active = false;
                                                break;
                                Severity: Minor
                                Found in lib/Users/User.php and 1 other location - About 30 mins to fix
                                lib/Users/User.php on lines 2345..2347

                                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

                                Avoid excessively long variable names like $flickr_oauth_token_secret. Keep variable name length under 20.
                                Open

                                    public $flickr_oauth_token_secret = "";
                                Severity: Minor
                                Found in lib/Users/User.php by phpmd

                                LongVariable

                                Since: 0.2

                                Detects when a field, formal or local variable is declared with a long name.

                                Example

                                class Something {
                                    protected $reallyLongIntName = -3; // VIOLATION - Field
                                    public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
                                        $otherReallyLongName = -5; // VIOLATION - Local
                                        for ($interestingIntIndex = 0; // VIOLATION - For
                                             $interestingIntIndex < 10;
                                             $interestingIntIndex++ ) {
                                        }
                                    }
                                }

                                Source https://phpmd.org/rules/naming.html#longvariable

                                Blank line found at start of control structure
                                Open

                                                if ($size = @getimagesize($this->avatar)) {
                                Severity: Minor
                                Found in lib/Users/User.php by phpcodesniffer

                                Blank line found at end of control structure
                                Open

                                Severity: Minor
                                Found in lib/Users/User.php by phpcodesniffer

                                Blank line found at end of control structure
                                Open

                                Severity: Minor
                                Found in lib/Users/User.php by phpcodesniffer

                                Blank line found at end of control structure
                                Open

                                Severity: Minor
                                Found in lib/Users/User.php by phpcodesniffer

                                Blank line found at start of control structure
                                Open

                                        } catch (Exception $e) {
                                Severity: Minor
                                Found in lib/Users/User.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/Users/User.php by phpcodesniffer

                                Blank line found at start of control structure
                                Open

                                        if (!is_array($data) || empty( $data ) || count($data) === 1) {
                                Severity: Minor
                                Found in lib/Users/User.php by phpcodesniffer

                                Blank line found at end of control structure
                                Open

                                Severity: Minor
                                Found in lib/Users/User.php by phpcodesniffer

                                Blank line found at start of control structure
                                Open

                                        if (count($args) === 2) {
                                Severity: Minor
                                Found in lib/Users/User.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/Users/User.php by phpcodesniffer

                                Blank line found at end of control structure
                                Open

                                Severity: Minor
                                Found in lib/Users/User.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/Users/User.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/Users/User.php by phpcodesniffer

                                Blank line found at start of control structure
                                Open

                                            if ($autologin_id = $this->db->fetchOne($query, array( $cookie[0], $cookie[1] ))) {
                                Severity: Minor
                                Found in lib/Users/User.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/Users/User.php by phpcodesniffer

                                Blank line found at start of control structure
                                Open

                                        if (!$this->guest) {
                                Severity: Minor
                                Found in lib/Users/User.php by phpcodesniffer

                                Blank line found at start of control structure
                                Open

                                        } elseif (!empty( $this->password )) {
                                Severity: Minor
                                Found in lib/Users/User.php by phpcodesniffer

                                Blank line found at end of control structure
                                Open

                                Severity: Minor
                                Found in lib/Users/User.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/Users/User.php by phpcodesniffer

                                Blank line found at start of control structure
                                Open

                                        if ($result = $this->db->fetchAll($query, intval($this->id))) {
                                Severity: Minor
                                Found in lib/Users/User.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/Users/User.php by phpcodesniffer

                                Blank line found at start of control structure
                                Open

                                        if ($username && !empty( $username ) && empty( $this->username )) {
                                Severity: Minor
                                Found in lib/Users/User.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/Users/User.php by phpcodesniffer

                                The 'getUserAccountStatus()' method which returns a boolean should be named 'is...()' or 'has...()'
                                Open

                                    public function getUserAccountStatus() {
                                
                                        if ((boolean)$this->active === true) {
                                            return self::STATUS_ACTIVE;
                                        }
                                Severity: Minor
                                Found in lib/Users/User.php by phpmd

                                BooleanGetMethodName

                                Since: 0.2

                                Looks for methods named 'getX()' with 'boolean' as the return type. The convention is to name these methods 'isX()' or 'hasX()'.

                                Example

                                class Foo {
                                    /**
                                     * @return boolean
                                     */
                                    public function getFoo() {} // bad
                                    /**
                                     * @return bool
                                     */
                                    public function isFoo(); // ok
                                    /**
                                     * @return boolean
                                     */
                                    public function getFoo($bar); // ok, unless checkParameterizedMethods=true
                                }

                                Source https://phpmd.org/rules/naming.html#booleangetmethodname

                                Inline control structures are not allowed
                                Open

                                                if ($i % 2 == 0)
                                Severity: Minor
                                Found in lib/Users/User.php by phpcodesniffer

                                There are no issues that match your filters.

                                Category
                                Status