File yf_utils.class.php
has 639 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
class yf_utils
{
/**
yf_utils
has 53 functions (exceeds 20 allowed). Consider refactoring. Open
class yf_utils
{
/**
* Catch missing method call.
* @param mixed $name
Function my_array_merge
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
public function my_array_merge($a1, $a2)
{
foreach ((array) $a2 as $k => $v) {
if (isset($a1[$k]) && is_array($a1[$k])) {
if (is_array($a2[$k])) {
- 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 _server_info
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
public function _server_info($server_id)
{
$cached_server_info = &main()->_cached_server_info;
if (is_numeric($server_id)) {
$server_id = (int) $server_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
Function _check_words_length
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
public function _check_words_length($text, $length = 0, $do_encode_email = false)
{
if (empty($length)) {
$length = 60;
if (SITE_MAX_WORD_LENGTH != 'SITE_MAX_WORD_LENGTH' && SITE_MAX_WORD_LENGTH != '') {
- 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 _account_info
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public function _account_info($account_id)
{
$cached_account_info = &main()->_cached_account_info;
if (is_numeric($account_id)) {
$account_id = (int) $account_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
Function _format_date
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public function _format_date($input_date = '', $type = 'short')
{
if ( ! strlen($input_date)) {
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 _check_words_length
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function _check_words_length($text, $length = 0, $do_encode_email = false)
{
if (empty($length)) {
$length = 60;
if (SITE_MAX_WORD_LENGTH != 'SITE_MAX_WORD_LENGTH' && SITE_MAX_WORD_LENGTH != '') {
Method _format_date
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function _format_date($input_date = '', $type = 'short')
{
if ( ! strlen($input_date)) {
return '';
}
Method _account_info
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function _account_info($account_id)
{
$cached_account_info = &main()->_cached_account_info;
if (is_numeric($account_id)) {
$account_id = (int) $account_id;
Method _server_info
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function _server_info($server_id)
{
$cached_server_info = &main()->_cached_server_info;
if (is_numeric($server_id)) {
$server_id = (int) $server_id;
Function _prepare_html
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function _prepare_html($text = '', $need_strip_slashes = 1, $use_smart_function = 1)
{
if (is_array($text)) {
foreach ((array) $text as $k => $v) {
$text[$k] = $this->_prepare_html($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
Method _show_avatar
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function _show_avatar($user_id = 0, $user_name = '', $as_link = 0, $is_middle = 0, $only_img_src = 0, $force_link = '')
{
if (is_array($user_name)) {
$user_info = $user_name;
$user_name = _display_name($user_info);
Method _prepare_html
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function _prepare_html($text = '', $need_strip_slashes = 1, $use_smart_function = 1)
{
if (is_array($text)) {
foreach ((array) $text as $k => $v) {
$text[$k] = $this->_prepare_html($v);
Function checkdnsrr
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function checkdnsrr($hostName, $recType = '')
{
if ( ! empty($hostName)) {
if ($recType == '') {
$recType = 'MX';
- 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_avatar
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
public function _show_avatar($user_id = 0, $user_name = '', $as_link = 0, $is_middle = 0, $only_img_src = 0, $force_link = '')
Method _gen_dir_path
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public function _gen_dir_path($id, $path = '', $make = false, $dir_mode = 0755, $create_index_htmls = 1)
Function text_filter
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function text_filter($str)
{
$str = htmlspecialchars($str);
if (defined('SITE_BAD_WORD_FILTER') && SITE_BAD_WORD_FILTER == 1) {
$bad_words = conf('BAD_WORDS_ARRAY');
- 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 highlight
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function highlight($string, $search_words, $tag = 'span', $class = 's_word')
{
if (empty($string) || empty($search_words)) {
return $string;
}
- 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"