File yf_debug.class.php
has 1386 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Debug console.
*
yf_debug
has 52 functions (exceeds 20 allowed). Consider refactoring. Open
class yf_debug
{
public $SHOW_DB_QUERY_LOG = true;
public $SHOW_DB_STATS = false;
public $SHOW_DB_EXPLAIN_QUERY = true;
Method _debug_DEBUG_YF
has 151 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function _debug_DEBUG_YF(&$params = [])
{
if ( ! $this->SHOW_SETTINGS) {
return '';
}
Function _do_debug_db_connection_queries
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
public function _do_debug_db_connection_queries($db, $connect_trace = [])
{
if ( ! $this->SHOW_DB_QUERY_LOG) {
return '';
}
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method _do_debug_db_connection_queries
has 102 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function _do_debug_db_connection_queries($db, $connect_trace = [])
{
if ( ! $this->SHOW_DB_QUERY_LOG) {
return '';
}
Function _show_auto_table
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
public function _show_auto_table($items = [], $params = [], $name = '')
{
if ( ! is_array($items)) {
$items = [];
}
- Read upRead up
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 go
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
public function go()
{
if ($this->DEBUG_CONSOLE_HIDDEN) {
return false;
}
- Read upRead up
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 _get_git_details
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
public function _get_git_details($FS_PATH, $as_submodule = false)
{
$git_base_path = $FS_PATH . '.git';
if ( ! file_exists($git_base_path)) {
return [];
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method go
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function go()
{
if ($this->DEBUG_CONSOLE_HIDDEN) {
return false;
}
Method _get_git_details
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function _get_git_details($FS_PATH, $as_submodule = false)
{
$git_base_path = $FS_PATH . '.git';
if ( ! file_exists($git_base_path)) {
return [];
Function _debug_DEBUG_YF
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public function _debug_DEBUG_YF(&$params = [])
{
if ( ! $this->SHOW_SETTINGS) {
return '';
}
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method _show_auto_table
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function _show_auto_table($items = [], $params = [], $name = '')
{
if ( ! is_array($items)) {
$items = [];
}
Method _debug_stpls
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function _debug_stpls(&$params = [])
{
if ( ! $this->SHOW_STPLS) {
return '';
}
Method _debug_redis
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function _debug_redis(&$params = [])
{
if ( ! $this->SHOW_REDIS_INFO) {
return '';
}
Method _debug_globals
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function _debug_globals(&$params = [])
{
if ( ! $this->SHOW_GLOBALS) {
return '';
}
Method _debug_profiling
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function _debug_profiling(&$params = [])
{
$all_timings = main()->_timing;
if ( ! $all_timings) {
return false;
Function _show_key_val_table
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function _show_key_val_table($a, $params = [], $name = '')
{
if ( ! $a) {
return false;
}
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method _debug_assets
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function _debug_assets(&$params = [])
{
$body = [];
$items = $this->_get_debug_data('assets_out');
Method _show_key_val_table
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function _show_key_val_table($a, $params = [], $name = '')
{
if ( ! $a) {
return false;
}
Function _debug_profiling
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function _debug_profiling(&$params = [])
{
$all_timings = main()->_timing;
if ( ! $all_timings) {
return false;
- Read upRead up
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 _debug_dashboard
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function _debug_dashboard()
{
if ( ! $this->SHOW_DB_STATS) {
return '';
}
- Read upRead up
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 _get_request_headers
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function _get_request_headers()
{
$arh = [];
$rx_http = '/(\AHTTP_)/';
foreach ((array) $_SERVER as $key => $val) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method _debug_rewrite
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function _debug_rewrite(&$params = [])
{
if ( ! $this->SHOW_REWRITE_INFO) {
return '';
}
Method _debug_memcached
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function _debug_memcached(&$params = [])
{
if ( ! $this->SHOW_MEMCACHED_INFO) {
return '';
}
Method _debug_sphinxsearch
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function _debug_sphinxsearch(&$params = [])
{
if ( ! $this->SHOW_SPHINX) {
return '';
}
Method _debug_dashboard
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function _debug_dashboard()
{
if ( ! $this->SHOW_DB_STATS) {
return '';
}
Function _debug_stpls
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function _debug_stpls(&$params = [])
{
if ( ! $this->SHOW_STPLS) {
return '';
}
- Read upRead up
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 _debug_redis
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function _debug_redis(&$params = [])
{
if ( ! $this->SHOW_REDIS_INFO) {
return '';
}
- Read upRead up
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 _debug_memcached
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function _debug_memcached(&$params = [])
{
if ( ! $this->SHOW_MEMCACHED_INFO) {
return '';
}
- Read upRead up
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 _debug_globals
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function _debug_globals(&$params = [])
{
if ( ! $this->SHOW_GLOBALS) {
return '';
}
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Avoid too many return
statements within this method. Open
return $body;
Function _debug_sphinxsearch
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function _debug_sphinxsearch(&$params = [])
{
if ( ! $this->SHOW_SPHINX) {
return '';
}
- Read upRead up
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 _debug_table2
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function _debug_table2(&$params = [])
{
if ( ! $this->SHOW_TABLE2) {
return '';
}
- Read upRead up
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 _admin_link
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function _admin_link($type, $text = '', $just_link = false, $replace = [])
{
if ( ! $this->ADD_ADMIN_LINKS || ! isset($this->ADMIN_PATHS[$type])) {
return $text;
}
- Read upRead up
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 _get_yf_version
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function _get_yf_version()
{
$out = [];
$as_submodule = false;
if (strlen(YF_PATH) > strlen(APP_PATH) && substr(YF_PATH, 0, strlen(APP_PATH)) === APP_PATH) {
- Read upRead up
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 _debug_events
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function _debug_events(&$params = [])
{
$main_ts = main()->_time_start;
$items = [];
foreach (['listen', 'fire', 'queue'] as $name) {
- Read upRead up
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 _time_count_changes
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function _time_count_changes($items = [], $field = 'time')
{
$time_all = 0;
$time_max = 0;
foreach ((array) $items as $i => $v) {
- Read upRead up
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
Similar blocks of code found in 3 locations. Consider refactoring. Open
public function _debug_get_data(&$params = [])
{
if ( ! $this->SHOW_MAIN_GET_DATA) {
return '';
}
- 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 194.
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 _debug_cache_get(&$params = [])
{
if ( ! $this->SHOW_CORE_CACHE) {
return '';
}
- 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 194.
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 _debug_cache_set(&$params = [])
{
if ( ! $this->SHOW_CORE_CACHE) {
return '';
}
- 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 194.
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