File class_rewrite_testing_shared.php
has 426 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
require_once __DIR__ . '/yf_unit_tests_setup.php';
class class_rewrite_testing_shared extends yf\tests\wrapper
{
Method test_rewrite_replace_links
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function test_rewrite_replace_links()
{
$GLOBALS['PROJECT_CONF']['tpl']['REWRITE_MODE'] = true;
$host = self::$host;
class_rewrite_testing_shared
has 21 functions (exceeds 20 allowed). Consider refactoring. Open
class class_rewrite_testing_shared extends yf\tests\wrapper
{
private static $host = 'test.dev';
private static $_bak_settings = [];
Method test_rewrite_disabled_simple
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function test_rewrite_disabled_simple()
{
$GLOBALS['PROJECT_CONF']['tpl']['REWRITE_MODE'] = false;
unset($_GET['debug']);
$this->assertEquals('http://' . self::$host . '/?object=test', process_url('./?object=test'));
Method test_correct_protocol
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function test_correct_protocol()
{
$old = main()->USE_ONLY_HTTPS;
main()->USE_ONLY_HTTPS = true;
Method test_https_enabled_for
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function test_https_enabled_for()
{
$old1 = main()->HTTPS_ENABLED_FOR;
$old2 = main()->USE_ONLY_HTTPS;
Method test_rewrite_short_form
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function test_rewrite_short_form()
{
$this->assertEquals('http://' . self::$host . '/test/my/123/456', url('/test/my/123/456', ['host' => self::$host]));
$this->assertEquals('http://' . self::$host . '/test', url('/test', ['host' => self::$host]));
Similar blocks of code found in 3 locations. Consider refactoring. Open
public function test_rewrite_url_user_disabled()
{
$GLOBALS['PROJECT_CONF']['tpl']['REWRITE_MODE'] = false;
$this->assertEquals('http://' . self::$host . '/', url_user());
$this->assertEquals('http://' . self::$host . '/', url_user(''));
- Read upRead up
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 411.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 3 locations. Consider refactoring. Open
public function test_rewrite_url_user_enabled()
{
$GLOBALS['PROJECT_CONF']['tpl']['REWRITE_MODE'] = true;
$this->assertEquals('http://' . self::$host . '/', url_user());
$this->assertEquals('http://' . self::$host . '/', url_user(''));
- Read upRead up
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 411.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 3 locations. Consider refactoring. Open
public function test_rewrite_disabled()
{
$GLOBALS['PROJECT_CONF']['tpl']['REWRITE_MODE'] = false;
$this->assertEquals('http://' . self::$host . '/', url());
$this->assertEquals('http://' . self::$host . '/', url(''));
- Read upRead up
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 411.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Identical blocks of code found in 2 locations. Consider refactoring. Open
public static function setUpBeforeClass() : void
{
self::$_bak_settings['REWRITE_MODE'] = $GLOBALS['PROJECT_CONF']['tpl']['REWRITE_MODE'];
$GLOBALS['PROJECT_CONF']['tpl']['REWRITE_MODE'] = true;
$_GET = [
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 103.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76