Showing 35 of 42 total issues
Method anonymous_avatar_data
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function anonymous_avatar_data( $args, $id_or_email ) {
$local = apply_filters( 'semantic_linkbacks_local_avatars', array( 'mm', 'mystery', 'mysteryman' ) );
if ( ! in_array( $args['default'], $local, true ) ) {
return $args;
}
Method comment_class
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function comment_class( $classes, $class, $comment_id, $post_id ) {
// get comment
$comment = get_comment( $comment_id );
// "comment type to class" mapper
$class_mapping = array(
Function get_linkbacks_number
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
function get_linkbacks_number( $type = null, $post_id = null ) {
if ( null === $post_id ) {
$post_id = get_the_ID();
}
$args = 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 enhance
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public static function enhance( $commentdata, $comment = array(), $commentarr = array() ) {
// check if comment is a linkback
if ( ! in_array( $commentdata['comment_type'], apply_filters( 'semantic_linkbacks_enhance_comment_types', array( 'webmention', 'pingback', 'trackback' ) ), true ) ) {
return $commentdata;
}
- 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_entries
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public static function get_entries( $mf_array ) {
$entries = array();
// some basic checks
if ( ! is_array( $mf_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
Avoid deeply nested control flow statements. Open
if ( isset( $mf_array['rels']['me'] ) ) {
$mf['properties']['me'] = $mf_array['rels']['me'];
}
Method start_el
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public function start_el( &$output, $comment, $depth = 0, $args = array(), $id = 0 ) {
Function bulk_send_notifications
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public static function bulk_send_notifications( $redirect_to, $doaction, $comment_ids ) {
if ( ! in_array( $doaction, array( 'resend_notification_email', 'resend_moderation_email', 'send_pushover_text' ), true ) ) {
return $redirect_to;
}
foreach ( $comment_ids as $comment_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 get_linkbacks
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function get_linkbacks( $type = null, $post_id = null, $order = 'DESC' ) {
if ( null === $post_id ) {
$post_id = get_the_ID();
}
$args = 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 comment_text_excerpt
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public static function comment_text_excerpt( $text, $comment = null, $args = array() ) {
if ( ! is_object( $comment ) ) {
$comment = get_comment( $comment );
}
- 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 $args;
Avoid too many return
statements within this method. Open
return 'mention';
Avoid too many return
statements within this method. Open
return $entries[0];
Function save_comment_meta
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public static function save_comment_meta( $comment_id ) {
// If this is an autosave, our form has not been submitted, so we don't want to do anything.
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
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_property
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public static function get_property( $key, $properties ) {
if ( isset( $properties[ $key ] ) && isset( $properties[ $key ][0] ) ) {
if ( is_array( $properties[ $key ] ) ) {
$properties[ $key ] = array_unique( $properties[ $key ] );
}
- 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"