railpage/railpagecore

View on GitHub
lib/AppCore.php

Summary

Maintainability
F
1 wk
Test Coverage

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

<?php

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

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

        public function __construct() {
            global $ZendDB, $ZendDB_ReadOnly, $PHPUnitTest;
            
            /**
             * Create the registry
    Severity: Minor
    Found in lib/AppCore.php - About 3 hrs to fix

    Cognitive Complexity

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

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

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

    Further reading

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

    class AppCore {
        
        /**
         * Database object
         * @var object $db An instance of ZendDB or sql_db representing a database connection.
    Severity: Minor
    Found in lib/AppCore.php by phpmd

    AppCore has 26 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class AppCore {
        
        /**
         * Database object
         * @var object $db An instance of ZendDB or sql_db representing a database connection.
    Severity: Minor
    Found in lib/AppCore.php - About 3 hrs to fix

      Method __construct has 69 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function __construct() {
              global $ZendDB, $ZendDB_ReadOnly, $PHPUnitTest;
              
              /**
               * Create the registry
      Severity: Major
      Found in lib/AppCore.php - About 2 hrs to fix

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

            public static function getConfig() {
                $Registry = Registry::getInstance();
                
                try {
                    $Config = $Registry->get("config");
        Severity: Minor
        Found in lib/AppCore.php - About 1 hr to fix

          Method getLogger has 29 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public static function getLogger() {
                  
                  $Registry = Registry::getInstance();
                  
                  $Config = self::getConfig();
          Severity: Minor
          Found in lib/AppCore.php - About 1 hr to fix

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

                public static function getSmarty() {
                    
                    $Registry = Registry::getInstance(); 
                    
                    $Config = self::getConfig(); 
            Severity: Minor
            Found in lib/AppCore.php - About 1 hr to fix

              Function getConfig has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                  public static function getConfig() {
                      $Registry = Registry::getInstance();
                      
                      try {
                          $Config = $Registry->get("config");
              Severity: Minor
              Found in lib/AppCore.php - About 55 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 getLogger has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  public static function getLogger() {
                      
                      $Registry = Registry::getInstance();
                      
                      $Config = self::getConfig();
              Severity: Minor
              Found in lib/AppCore.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 getMemcache has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  public static function getMemcache($reload = false) {
                      
                      if (!extension_loaded("memcache") || defined("PHPUNIT_RAILPAGE_TESTSUITE")) {
                          return new NullCacheDriver;
                      }
              Severity: Minor
              Found in lib/AppCore.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 getRedis has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  public static function getRedis($reload = false) {
                      if (!extension_loaded("redis") || (defined("NOREDIS") && NOREDIS == true)) {
                          return new NullCacheDriver;
                      }
                      
              Severity: Minor
              Found in lib/AppCore.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 method __construct() has 124 lines of code. Current threshold is set to 100. Avoid really long methods.
              Open

                  public function __construct() {
                      global $ZendDB, $ZendDB_ReadOnly, $PHPUnitTest;
                      
                      /**
                       * Create the registry
              Severity: Minor
              Found in lib/AppCore.php by phpmd

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

                  public function __construct() {
                      global $ZendDB, $ZendDB_ReadOnly, $PHPUnitTest;
                      
                      /**
                       * Create the registry
              Severity: Minor
              Found in lib/AppCore.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

              Avoid using undefined variables such as '$db' which will lead to PHP notices.
              Open

                                      $this->db = $db;
              Severity: Minor
              Found in lib/AppCore.php by phpmd

              UndefinedVariable

              Since: 2.8.0

              Detects when a variable is used that has not been defined before.

              Example

              class Foo
              {
                  private function bar()
                  {
                      // $message is undefined
                      echo $message;
                  }
              }

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

              Avoid using undefined variables such as '$RailpageConfig' which will lead to PHP notices.
              Open

                              $Config = $RailpageConfig;
              Severity: Minor
              Found in lib/AppCore.php by phpmd

              UndefinedVariable

              Since: 2.8.0

              Detects when a variable is used that has not been defined before.

              Example

              class Foo
              {
                  private function bar()
                  {
                      // $message is undefined
                      echo $message;
                  }
              }

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

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

              class AppCore {
                  
                  /**
                   * Database object
                   * @var object $db An instance of ZendDB or sql_db representing a database connection.
              Severity: Minor
              Found in lib/AppCore.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 deleteCache has a boolean flag argument $key, which is a certain sign of a Single Responsibility Principle violation.
              Open

                  protected function deleteCache($key = false) {
              Severity: Minor
              Found in lib/AppCore.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 removeCache has a boolean flag argument $key, which is a certain sign of a Single Responsibility Principle violation.
              Open

                  protected function removeCache($key = false) {
              Severity: Minor
              Found in lib/AppCore.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 setDatabaseReadOnlyConnection has a boolean flag argument $cn, which is a certain sign of a Single Responsibility Principle violation.
              Open

                  public function setDatabaseReadOnlyConnection($cn = false) {
              Severity: Minor
              Found in lib/AppCore.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 getCache has a boolean flag argument $key, which is a certain sign of a Single Responsibility Principle violation.
              Open

                  protected function getCache($key = false) {
              Severity: Minor
              Found in lib/AppCore.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 getMemcache has a boolean flag argument $reload, which is a certain sign of a Single Responsibility Principle violation.
              Open

                  public static function getMemcache($reload = false) {
              Severity: Minor
              Found in lib/AppCore.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 getRedis has a boolean flag argument $reload, which is a certain sign of a Single Responsibility Principle violation.
              Open

                  public static function getRedis($reload = false) {
              Severity: Minor
              Found in lib/AppCore.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 setCache has a boolean flag argument $key, which is a certain sign of a Single Responsibility Principle violation.
              Open

                  protected function setCache($key = false, $value = "thisisanemptyvalue", $exp = 0) {
              Severity: Minor
              Found in lib/AppCore.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 setDatabaseConnection has a boolean flag argument $cn, which is a certain sign of a Single Responsibility Principle violation.
              Open

                  public function setDatabaseConnection($cn = false) {
              Severity: Minor
              Found in lib/AppCore.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 __construct uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
              Open

                              } else {
                                  
                                  // Attempt to resolve the DB connection to a stream path. If it can't be resolved, assume this is a CI environment and load a test DB connector
                                  
                                  Debug::logEvent(__METHOD__ . " -- Looking for db " . DS . "connect.php");
              Severity: Minor
              Found in lib/AppCore.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 __deconstruct uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
              Open

                          } else {
                              #$this->closeConnection(); 
                          }
              Severity: Minor
              Found in lib/AppCore.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 __construct uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
              Open

                      } else {
                          
                          /**
                           * Load / set the database instance
                           */
              Severity: Minor
              Found in lib/AppCore.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 '766', column '22').
              Open

                  public static function getLogger() {
                      
                      $Registry = Registry::getInstance();
                      
                      $Config = self::getConfig();
              Severity: Minor
              Found in lib/AppCore.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 unused local variables such as '$RailpageConfig'.
              Open

                              $Config = $RailpageConfig;
              Severity: Minor
              Found in lib/AppCore.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

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

                                      $this->db = $db;
              Severity: Minor
              Found in lib/AppCore.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

                      try {
                          $cacheDriver = $Registry->get("redis");
                      } catch (Exception $e) {
                          $Redis = new Redis;
                          $Redis->connect($Config->Memcached->Host, 6379);
              Severity: Major
              Found in lib/AppCore.php and 1 other location - About 3 hrs to fix
              lib/AppCore.php on lines 664..674

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

              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

                      try {
                          $cacheDriver = $Registry->get("memcached");
                      } catch (Exception $e) {
                          $Memcached = new PhpMemcached;
                          $Memcached->addServer($Config->Memcached->Host, 11211);
              Severity: Major
              Found in lib/AppCore.php and 1 other location - About 3 hrs to fix
              lib/AppCore.php on lines 595..605

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

              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 setDatabaseReadOnlyConnection($cn = false) {
                      if (!is_object($cn)) {
                          throw new Exception("Invalid database connection specified");
                      }
                      
              Severity: Major
              Found in lib/AppCore.php and 1 other location - About 1 hr to fix
              lib/AppCore.php on lines 714..722

              Duplicated Code

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

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

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

              Tuning

              This issue has a mass of 49.

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

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

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

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

              Refactorings

              Further Reading

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

                  public function setDatabaseConnection($cn = false) {
                      if (!is_object($cn)) {
                          throw new Exception("Invalid database connection specified");
                      }
                      
              Severity: Major
              Found in lib/AppCore.php and 1 other location - About 1 hr to fix
              lib/AppCore.php on lines 731..739

              Duplicated Code

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

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

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

              Tuning

              This issue has a mass of 49.

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

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

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

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

              Refactorings

              Further Reading

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

                  protected function removeCache($key = false) {
                      if (!$this->useCache) {
                          return false;
                      }
                      
              Severity: Major
              Found in lib/AppCore.php and 2 other locations - About 1 hr to fix
              lib/AppCore.php on lines 354..360
              lib/AppCore.php on lines 386..392

              Duplicated Code

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

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

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

              Tuning

              This issue has a mass of 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 3 locations. Consider refactoring.
              Open

                  protected function deleteCache($key = false) {
                      if (!$this->useCache) {
                          return false;
                      }
                      
              Severity: Major
              Found in lib/AppCore.php and 2 other locations - About 1 hr to fix
              lib/AppCore.php on lines 354..360
              lib/AppCore.php on lines 370..376

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

                  protected function getCache($key = false) {
                      if (!$this->useCache) {
                          return false;
                      }
                      
              Severity: Major
              Found in lib/AppCore.php and 2 other locations - About 1 hr to fix
              lib/AppCore.php on lines 370..376
              lib/AppCore.php on lines 386..392

              Duplicated Code

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

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

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

              Tuning

              This issue has a mass of 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

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

                              $Config = json_decode(file_get_contents(RP_SITE_ROOT . DS . "config" . DS . "config.railpage.json")); 
              Severity: Major
              Found in lib/AppCore.php and 1 other location - About 1 hr to fix
              lib/AppCore.php on lines 541..541

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

              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

                          } elseif (defined("RP_SITE_ROOT") && file_exists(RP_SITE_ROOT . DS . "config" . DS . "config.railpage.json")) {
              Severity: Major
              Found in lib/AppCore.php and 1 other location - About 1 hr to fix
              lib/AppCore.php on lines 543..543

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

              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 (!extension_loaded("memcache") || defined("PHPUNIT_RAILPAGE_TESTSUITE")) {
                          return new NullCacheDriver;
                      }
              Severity: Major
              Found in lib/AppCore.php and 1 other location - About 1 hr to fix
              lib/AppCore.php on lines 656..658

              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 (!extension_loaded("memcached") || defined("PHPUNIT_RAILPAGE_TESTSUITE")) {
                          return new NullCacheDriver;
                      }
              Severity: Major
              Found in lib/AppCore.php and 1 other location - About 1 hr to fix
              lib/AppCore.php on lines 619..621

              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

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

                              } elseif (file_exists(".." . DS . "db" . DS . "zend_db.php")) {
                                  Debug::logEvent(__METHOD__ . " -- Looking for .." . DS . "db " . DS . "zend_db.php");
                                  require(".." . DS . "db" . DS . "zend_db.php"); 
                                  $this->db = $ZendDB;
                                  $this->destroy = true;
              Severity: Major
              Found in lib/AppCore.php and 1 other location - About 1 hr to fix
              lib/AppCore.php on lines 264..268

              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

                              } elseif (file_exists(".." . DS . "db" . DS . "zend_db.php")) {
                                  require(".." . DS . "db" . DS . "zend_db.php"); 
                                  $this->db_readonly = $ZendDB_ReadOnly;
                                  $this->destroy = true;
                              }
              Severity: Major
              Found in lib/AppCore.php and 1 other location - About 1 hr to fix
              lib/AppCore.php on lines 229..234

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

              if (!defined("DS")) {
                  define("DS", DIRECTORY_SEPARATOR);
              }
              Severity: Major
              Found in lib/AppCore.php and 2 other locations - About 1 hr to fix
              lib/Downloads/Base.php on lines 17..19
              lib/Memcached.php on lines 54..56

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

                          } elseif (file_exists(dirname(__DIR__) . DS . "config" . DS . "dist.config.railpage.php")) {
              Severity: Major
              Found in lib/AppCore.php and 2 other locations - About 1 hr to fix
              lib/AppCore.php on lines 549..549
              lib/Template.php on lines 532..532

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

                              require_once(dirname(__DIR__) . DS . "config" . DS . "dist.config.railpage.php");
              Severity: Major
              Found in lib/AppCore.php and 2 other locations - About 1 hr to fix
              lib/AppCore.php on lines 547..547
              lib/Template.php on lines 532..532

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

              if (!defined("RP_HOST")) {
                  define("RP_HOST", "www.railpage.com.au");
              }
              Severity: Major
              Found in lib/AppCore.php and 7 other locations - About 50 mins to fix
              lib/Formatting/MultimediaUtility.php on lines 27..29
              lib/Users/User.php on lines 1346..1348
              lib/AppCore.php on lines 38..40
              lib/AppCore.php on lines 42..44
              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 8 locations. Consider refactoring.
              Open

              if (!defined("RP_WEB_ROOT")) {
                  define("RP_WEB_ROOT", "");
              }
              Severity: Major
              Found in lib/AppCore.php and 7 other locations - About 50 mins to fix
              lib/Formatting/MultimediaUtility.php on lines 27..29
              lib/Users/User.php on lines 1346..1348
              lib/AppCore.php on lines 38..40
              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 8 locations. Consider refactoring.
              Open

              if (!defined("RP_SITE_ROOT")) {
                  define("RP_SITE_ROOT", "");
              }
              Severity: Major
              Found in lib/AppCore.php and 7 other locations - About 50 mins to fix
              lib/Formatting/MultimediaUtility.php on lines 27..29
              lib/Users/User.php on lines 1346..1348
              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

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

                      $replace = array_fill(0, count($find), ""); 
              Severity: Minor
              Found in lib/AppCore.php and 1 other location - About 50 mins to fix
              lib/Formatting/MultimediaUtility.php on lines 189..189

              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

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

                                  require(".." . DS . "db" . DS . "zend_db.php"); 
              Severity: Minor
              Found in lib/AppCore.php and 1 other location - About 50 mins to fix
              lib/AppCore.php on lines 231..231

              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

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

                                  require(".." . DS . "db" . DS . "zend_db.php"); 
              Severity: Minor
              Found in lib/AppCore.php and 1 other location - About 50 mins to fix
              lib/AppCore.php on lines 265..265

              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

                              Debug::logEvent(__METHOD__ . " -- Loading " . dirname(__DIR__) . DS . "config.railpage.json");
              Severity: Minor
              Found in lib/AppCore.php and 1 other location - About 50 mins to fix
              lib/AppCore.php on lines 548..548

              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

                              Debug::logEvent(__METHOD__ . " -- Loading " . dirname(__DIR__) . DS . "config" . DS . "dist.config.railpage.php");
              Severity: Minor
              Found in lib/AppCore.php and 1 other location - About 50 mins to fix
              lib/AppCore.php on lines 545..545

              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

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

                              $Config = json_decode(file_get_contents(dirname(__DIR__) . DS . "config.railpage.json"));
              Severity: Minor
              Found in lib/AppCore.php and 1 other location - About 45 mins to fix
              lib/AppCore.php on lines 544..544

              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

                          } elseif (file_exists(dirname(__DIR__) . DS . "config.railpage.json")) {
              Severity: Minor
              Found in lib/AppCore.php and 1 other location - About 45 mins to fix
              lib/AppCore.php on lines 546..546

              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

                                  Debug::logEvent(__METHOD__ . " -- Looking for db " . DS . "connect.php");
              Severity: Minor
              Found in lib/AppCore.php and 1 other location - About 45 mins to fix
              lib/AppCore.php on lines 225..225

              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

                                  Debug::logEvent(__METHOD__ . " -- Looking for db " . DS . "zend_db.php");
              Severity: Minor
              Found in lib/AppCore.php and 1 other location - About 45 mins to fix
              lib/AppCore.php on lines 238..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 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

                          $Smarty->assign("rp_map_styles", json_encode($Config->Google->Maps->Styles));
              Severity: Minor
              Found in lib/AppCore.php and 1 other location - About 45 mins to fix
              lib/AppCore.php on lines 864..864

              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

                          $Smarty->assign("rp_map_icons", json_encode($Config->Google->Maps->Icons));
              Severity: Minor
              Found in lib/AppCore.php and 1 other location - About 45 mins to fix
              lib/AppCore.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 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 25 locations. Consider refactoring.
              Open

                  public function setAuthor(User $userObject) {
                      
                      $this->Author = $userObject;
                      
                      return $this;
              Severity: Major
              Found in lib/AppCore.php and 24 other locations - About 40 mins to fix
              lib/Feedback/Feedback.php on lines 52..56
              lib/Gallery/Album.php on lines 279..285
              lib/Gallery/Album.php on lines 317..323
              lib/Gallery/Image.php on lines 278..284
              lib/Gallery/Image.php on lines 460..466
              lib/Glossary/Entry.php on lines 302..306
              lib/Locations/Correction.php on lines 118..124
              lib/News/Article.php on lines 941..945
              lib/Prerender/Prerender.php on lines 89..94
              lib/Railcams/Footage.php on lines 89..95
              lib/Railcams/Photo.php on lines 143..147
              lib/Railcams/Storage.php on lines 95..101
              lib/Railcams/Storage.php on lines 110..116
              lib/SiteMessages/SiteMessage.php on lines 206..210
              lib/Timetables/Timetables.php on lines 52..56
              lib/Timetables/Timetables.php on lines 64..68
              lib/Timetables/Timetables.php on lines 76..80
              lib/Users/SockpuppetManager.php on lines 61..67
              lib/Warnings/Warning.php on lines 249..255
              lib/Warnings/Warning.php on lines 267..273
              lib/AppCore.php on lines 401..407
              lib/AppCore.php on lines 431..437
              lib/AppCore.php on lines 463..469
              lib/AppCore.php on lines 478..484

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

                  public function setRecipient(User $userObject) {
                      
                      $this->Recipient = $userObject;
                      
                      return $this;
              Severity: Major
              Found in lib/AppCore.php and 24 other locations - About 40 mins to fix
              lib/Feedback/Feedback.php on lines 52..56
              lib/Gallery/Album.php on lines 279..285
              lib/Gallery/Album.php on lines 317..323
              lib/Gallery/Image.php on lines 278..284
              lib/Gallery/Image.php on lines 460..466
              lib/Glossary/Entry.php on lines 302..306
              lib/Locations/Correction.php on lines 118..124
              lib/News/Article.php on lines 941..945
              lib/Prerender/Prerender.php on lines 89..94
              lib/Railcams/Footage.php on lines 89..95
              lib/Railcams/Photo.php on lines 143..147
              lib/Railcams/Storage.php on lines 95..101
              lib/Railcams/Storage.php on lines 110..116
              lib/SiteMessages/SiteMessage.php on lines 206..210
              lib/Timetables/Timetables.php on lines 52..56
              lib/Timetables/Timetables.php on lines 64..68
              lib/Timetables/Timetables.php on lines 76..80
              lib/Users/SockpuppetManager.php on lines 61..67
              lib/Warnings/Warning.php on lines 249..255
              lib/Warnings/Warning.php on lines 267..273
              lib/AppCore.php on lines 401..407
              lib/AppCore.php on lines 416..422
              lib/AppCore.php on lines 431..437
              lib/AppCore.php on lines 463..469

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

                  public function setGuest(User $userObject) {
                      
                      $this->Guest = $userObject;
                      
                      return $this;
              Severity: Major
              Found in lib/AppCore.php and 24 other locations - About 40 mins to fix
              lib/Feedback/Feedback.php on lines 52..56
              lib/Gallery/Album.php on lines 279..285
              lib/Gallery/Album.php on lines 317..323
              lib/Gallery/Image.php on lines 278..284
              lib/Gallery/Image.php on lines 460..466
              lib/Glossary/Entry.php on lines 302..306
              lib/Locations/Correction.php on lines 118..124
              lib/News/Article.php on lines 941..945
              lib/Prerender/Prerender.php on lines 89..94
              lib/Railcams/Footage.php on lines 89..95
              lib/Railcams/Photo.php on lines 143..147
              lib/Railcams/Storage.php on lines 95..101
              lib/Railcams/Storage.php on lines 110..116
              lib/SiteMessages/SiteMessage.php on lines 206..210
              lib/Timetables/Timetables.php on lines 52..56
              lib/Timetables/Timetables.php on lines 64..68
              lib/Timetables/Timetables.php on lines 76..80
              lib/Users/SockpuppetManager.php on lines 61..67
              lib/Warnings/Warning.php on lines 249..255
              lib/Warnings/Warning.php on lines 267..273
              lib/AppCore.php on lines 401..407
              lib/AppCore.php on lines 416..422
              lib/AppCore.php on lines 431..437
              lib/AppCore.php on lines 478..484

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

                  public function setStaff(User $userObject) {
                      
                      $this->Staff = $userObject;
                      
                      return $this;
              Severity: Major
              Found in lib/AppCore.php and 24 other locations - About 40 mins to fix
              lib/Feedback/Feedback.php on lines 52..56
              lib/Gallery/Album.php on lines 279..285
              lib/Gallery/Album.php on lines 317..323
              lib/Gallery/Image.php on lines 278..284
              lib/Gallery/Image.php on lines 460..466
              lib/Glossary/Entry.php on lines 302..306
              lib/Locations/Correction.php on lines 118..124
              lib/News/Article.php on lines 941..945
              lib/Prerender/Prerender.php on lines 89..94
              lib/Railcams/Footage.php on lines 89..95
              lib/Railcams/Photo.php on lines 143..147
              lib/Railcams/Storage.php on lines 95..101
              lib/Railcams/Storage.php on lines 110..116
              lib/SiteMessages/SiteMessage.php on lines 206..210
              lib/Timetables/Timetables.php on lines 52..56
              lib/Timetables/Timetables.php on lines 64..68
              lib/Timetables/Timetables.php on lines 76..80
              lib/Users/SockpuppetManager.php on lines 61..67
              lib/Warnings/Warning.php on lines 249..255
              lib/Warnings/Warning.php on lines 267..273
              lib/AppCore.php on lines 401..407
              lib/AppCore.php on lines 416..422
              lib/AppCore.php on lines 463..469
              lib/AppCore.php on lines 478..484

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

                  public function setUser(User $userObject) {
                      
                      $this->User = $userObject;
                      
                      return $this;
              Severity: Major
              Found in lib/AppCore.php and 24 other locations - About 40 mins to fix
              lib/Feedback/Feedback.php on lines 52..56
              lib/Gallery/Album.php on lines 279..285
              lib/Gallery/Album.php on lines 317..323
              lib/Gallery/Image.php on lines 278..284
              lib/Gallery/Image.php on lines 460..466
              lib/Glossary/Entry.php on lines 302..306
              lib/Locations/Correction.php on lines 118..124
              lib/News/Article.php on lines 941..945
              lib/Prerender/Prerender.php on lines 89..94
              lib/Railcams/Footage.php on lines 89..95
              lib/Railcams/Photo.php on lines 143..147
              lib/Railcams/Storage.php on lines 95..101
              lib/Railcams/Storage.php on lines 110..116
              lib/SiteMessages/SiteMessage.php on lines 206..210
              lib/Timetables/Timetables.php on lines 52..56
              lib/Timetables/Timetables.php on lines 64..68
              lib/Timetables/Timetables.php on lines 76..80
              lib/Users/SockpuppetManager.php on lines 61..67
              lib/Warnings/Warning.php on lines 249..255
              lib/Warnings/Warning.php on lines 267..273
              lib/AppCore.php on lines 416..422
              lib/AppCore.php on lines 431..437
              lib/AppCore.php on lines 463..469
              lib/AppCore.php on lines 478..484

              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

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

                  protected function setCache($key = false, $value = "thisisanemptyvalue", $exp = 0) {
                      if (!$this->useCache) {
                          return false;
                      }
                      
              Severity: Minor
              Found in lib/AppCore.php and 1 other location - About 35 mins to fix
              lib/Memcached.php on lines 97..125

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

                              $Config = json_decode(json_encode($Config));
              Severity: Major
              Found in lib/AppCore.php and 6 other locations - About 30 mins to fix
              lib/Images/Utility/CompNotify.php on lines 88..88
              lib/Images/Utility/ImageUtility.php on lines 94..94
              lib/Jobs/Locations.php on lines 78..78
              lib/Railcams/Camera.php on lines 856..856
              lib/ContentUtility.php on lines 109..109
              lib/Memcached.php on lines 65..65

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

                      $string = str_replace($find, $replace, $string);
              Severity: Major
              Found in lib/AppCore.php and 7 other locations - About 30 mins to fix
              lib/Formatting/BbcodeUtility.php on lines 109..109
              lib/Formatting/BbcodeUtility.php on lines 124..124
              lib/Formatting/MultimediaUtility.php on lines 191..191
              lib/Images/Exif.php on lines 230..230
              lib/Links/Links.php on lines 305..305
              lib/News/Base.php on lines 347..347
              lib/News/Utility/ArticleUtility.php on lines 97..97

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

                              } elseif (file_exists("db" . DS . "zend_db.php")) {
                                  require("db" . DS . "zend_db.php"); 
                                  $this->db_readonly = $ZendDB_ReadOnly;
                                  $this->destroy = true;
                              } elseif (file_exists(".." . DS . "db" . DS . "zend_db.php")) {
              Severity: Minor
              Found in lib/AppCore.php and 2 other locations - About 30 mins to fix
              lib/AppCore.php on lines 224..229
              lib/AppCore.php on lines 240..245

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

                              } elseif (file_exists("db" . DS . "zend_db.php")) {
                                  Debug::logEvent(__METHOD__ . " -- Looking for db " . DS . "zend_db.php");
                                  require("db" . DS . "zend_db.php"); 
                                  $this->db = $ZendDB;
                                  $this->destroy = true;
              Severity: Minor
              Found in lib/AppCore.php and 2 other locations - About 30 mins to fix
              lib/AppCore.php on lines 240..245
              lib/AppCore.php on lines 260..264

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

                                  if (stream_resolve_include_path("db" . DS . "connect.php")) {
                                      require("db" . DS . "connect.php"); 
                                      throw new Exception(__CLASS__." needs a database object");
                                      $this->db = $db;
                                      $this->destroy = true;
              Severity: Minor
              Found in lib/AppCore.php and 2 other locations - About 30 mins to fix
              lib/AppCore.php on lines 224..229
              lib/AppCore.php on lines 260..264

              Duplicated Code

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

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

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

              Tuning

              This issue has a mass of 20.

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

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

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

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

              Refactorings

              Further Reading

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

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

              Blank line found at end of control structure
              Open

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

              Blank line found at end of control structure
              Open

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

              Blank line found at start of control structure
              Open

                              } else {
              Severity: Minor
              Found in lib/AppCore.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/AppCore.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/AppCore.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/AppCore.php by phpcodesniffer

              Blank line found at start of control structure
              Open

                          if (isset($Config->SMTP)) {
              Severity: Minor
              Found in lib/AppCore.php by phpcodesniffer

              Blank line found at start of control structure
              Open

                          } catch (Exception $e) {
              Severity: Minor
              Found in lib/AppCore.php by phpcodesniffer

              Blank line found at start of control structure
              Open

                              if (!$mailStream = $Redis->fetch("railpage:logger.swiftmail")) {
              Severity: Minor
              Found in lib/AppCore.php by phpcodesniffer

              Blank line found at end of control structure
              Open

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

              Blank line found at start of control structure
              Open

                      if (isset($PHPUnitTest) && $PHPUnitTest === true) {
              Severity: Minor
              Found in lib/AppCore.php by phpcodesniffer

              Blank line found at start of control structure
              Open

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

              There are no issues that match your filters.

              Category
              Status