File yf_graphics.class.php
has 488 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Core content-related methods stored here.
*
Function show_metatags
has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring. Open
public function show_metatags($meta = [])
{
if (empty($meta)) {
$meta = $this->META_DEFAULT;
}
- 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 tip
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
public function tip($in = null, $extra = [])
{
if ( ! is_array($extra)) {
$extra = [];
}
- 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
yf_graphics
has 32 functions (exceeds 20 allowed). Consider refactoring. Open
class yf_graphics
{
/** @var bool Add pages names to the title */
public $ADD_TITLE_PAGES = true;
/** @var bool Show auto-parsed (and tried to translate) task name */
Method show_metatags
has 77 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function show_metatags($meta = [])
{
if (empty($meta)) {
$meta = $this->META_DEFAULT;
}
Method tip
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function tip($in = null, $extra = [])
{
if ( ! is_array($extra)) {
$extra = [];
}
Function show_site_title
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
public function show_site_title()
{
if (defined('SITE_ADVERT_NAME')) {
$title = SITE_ADVERT_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 quick_menu
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function quick_menu()
{
if ( ! $this->QUICK_MENU_ENABLED
|| (MAIN_TYPE_USER && ( ! isset($_SESSION['user_id']) || ! $_SESSION['user_id']))
|| (MAIN_TYPE_ADMIN && ( ! isset($_SESSION['admin_id']) || ! $_SESSION['admin_id']))
- 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_site_title
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function show_site_title()
{
if (defined('SITE_ADVERT_NAME')) {
$title = SITE_ADVERT_NAME;
}
Method quick_menu
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function quick_menu()
{
if ( ! $this->QUICK_MENU_ENABLED
|| (MAIN_TYPE_USER && ( ! isset($_SESSION['user_id']) || ! $_SESSION['user_id']))
|| (MAIN_TYPE_ADMIN && ( ! isset($_SESSION['admin_id']) || ! $_SESSION['admin_id']))
Function _send_main_headers
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function _send_main_headers($content_length = 0)
{
if (headers_sent($file, $line) || conf('no_headers')) {
// trigger_error('Headers were sent in '.$file.':'.$line, E_USER_WARNING);
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 show_welcome
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function show_welcome()
{
// For authorized admins only
if (MAIN_TYPE_ADMIN) {
$login_time = $_SESSION['admin_login_time'];
Function show_welcome
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function show_welcome()
{
// For authorized admins only
if (MAIN_TYPE_ADMIN) {
$login_time = $_SESSION['admin_login_time'];
- 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_header
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function _show_header()
{
if (conf('no_page_header')) {
return false;
}
Method _send_main_headers
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function _send_main_headers($content_length = 0)
{
if (headers_sent($file, $line) || conf('no_headers')) {
// trigger_error('Headers were sent in '.$file.':'.$line, E_USER_WARNING);
return false;
Consider simplifying this complex logical expression. Open
if ( ! $this->QUICK_MENU_ENABLED
|| (MAIN_TYPE_USER && ( ! isset($_SESSION['user_id']) || ! $_SESSION['user_id']))
|| (MAIN_TYPE_ADMIN && ( ! isset($_SESSION['admin_id']) || ! $_SESSION['admin_id']))
) {
return false;
Function _show_header
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function _show_header()
{
if (conf('no_page_header')) {
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 _send_custom_http_headers
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function _send_custom_http_headers()
{
// Override headers
$conf_headers = conf('http_headers');
if (is_array($conf_headers)) {
- 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 html()->tooltip($extra['text'], $extra);