railpage/railpagecore

lib/AppCore.php

Summary

F
1 wk

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

<?php

/**
* Railpage AppCore
* @since Version 3.7
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 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.
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. 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
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"); 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(); 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();  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");
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"

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

    public static function getLogger() {

$Registry = Registry::getInstance();$Config = self::getConfig();
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"

    public static function getMemcache($reload = false) { if (!extension_loaded("memcache") || defined("PHPUNIT_RAILPAGE_TESTSUITE")) { return new NullCacheDriver; } 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;
}

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"

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 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
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;
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

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.
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
*/

    protected function deleteCache($key = false) { 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) {
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 setDatabaseReadOnlyConnection($cn = false) { 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) {
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 static function getMemcache($reload = false) { 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) {
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 {

    protected function setCache($key = false,$value = "thisisanemptyvalue", $exp = 0) { 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) {
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"); 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();
}
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
*/
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();
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;
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;
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()
{
if (!$this->useCache) { return false; }  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")); 
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

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")) {
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

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

        if (!extension_loaded("memcache") || defined("PHPUNIT_RAILPAGE_TESTSUITE")) {
return new NullCacheDriver;
}
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

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

        if (!extension_loaded("memcached") || defined("PHPUNIT_RAILPAGE_TESTSUITE")) {
return new NullCacheDriver;
}
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

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; 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;
}
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

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

if (!defined("DS")) {
define("DS", DIRECTORY_SEPARATOR);
}
Found in lib/AppCore.php and 2 other locations - About 1 hr to fix
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

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

            } elseif (file_exists(dirname(__DIR__) . DS . "config" . DS . "dist.config.railpage.php")) {
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

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

                require_once(dirname(__DIR__) . DS . "config" . DS . "dist.config.railpage.php");
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

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

if (!defined("RP_HOST")) {
define("RP_HOST", "www.railpage.com.au");
}
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

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

if (!defined("RP_WEB_ROOT")) {
define("RP_WEB_ROOT", "");
}
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

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

if (!defined("RP_SITE_ROOT")) {
define("RP_SITE_ROOT", "");
}
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

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

        $replace = array_fill(0, count($find), ""); 
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

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

                    require(".." . DS . "db" . DS . "zend_db.php"); 
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

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

                    require(".." . DS . "db" . DS . "zend_db.php"); 
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

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

                Debug::logEvent(__METHOD__ . " -- Loading " . dirname(__DIR__) . DS . "config.railpage.json");
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

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

                Debug::logEvent(__METHOD__ . " -- Loading " . dirname(__DIR__) . DS . "config" . DS . "dist.config.railpage.php");
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

                $Config = json_decode(file_get_contents(dirname(__DIR__) . DS . "config.railpage.json")); 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")) { 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"); 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"); 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)); 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)); 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; 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; 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; 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; 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;

if (!$this->useCache) { return false; }  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)); 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); 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")) {
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

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; 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;
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

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

    }
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

    }
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

    }
Found in lib/AppCore.php by phpcodesniffer

Blank line found at end of control structure Open

            
Found in lib/AppCore.php by phpcodesniffer

Blank line found at end of control structure Open

            
Found in lib/AppCore.php by phpcodesniffer

Blank line found at start of control structure Open

                } else {
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

    }
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

    }
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

    }
Found in lib/AppCore.php by phpcodesniffer

            if (isset($Config->SMTP)) { Found in lib/AppCore.php by phpcodesniffer Blank line found at start of control structure Open  } catch (Exception$e) {
Found in lib/AppCore.php by phpcodesniffer

Blank line found at start of control structure Open

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

Blank line found at end of control structure Open

                
Found in lib/AppCore.php by phpcodesniffer

Blank line found at start of control structure Open

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

Blank line found at start of control structure Open

        } catch (Exception \$e) {
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

    }
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

    }
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

    }
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

    }
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

    }
Found in lib/AppCore.php by phpcodesniffer