MatthewMi11er/wordpress-plugin-mi11er-utility

View on GitHub
includes/mi11er-utility/class-redirect.php

Summary

Maintainability
A
2 hrs
Test Coverage

Showing 10 of 10 total issues

Method template_redirect_action has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

public function template_redirect_action() {
global $wpdb;
 
if ( ! is_404() ) {
return;
Severity: Minor
Found in includes/mi11er-utility/class-redirect.php - About 1 hr to fix

Function template_redirect_action has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

public function template_redirect_action() {
global $wpdb;
 
if ( ! is_404() ) {
return;
Severity: Minor
Found in includes/mi11er-utility/class-redirect.php - About 35 mins to fix

Avoid assigning values to variables in if clauses and the like (line '89', column '18').
Open

public function template_redirect_action() {
global $wpdb;
 
if ( ! is_404() ) {
return;

Avoid using static access to class '\Mi11er\Utility\Template_Tags' in method 'template_redirect_action'.
Open

$request_url = TT::get_the_request_url();

The method template_redirect_action() contains an exit expression.
Open

exit;

The parameter $post_type is not named in camelCase.
Open

function add_meta_boxes_action( $post_type, $post ) {
if ( ! empty( get_post_meta( $post->ID, self::META_FIELD, false ) ) ) {
add_meta_box(
self::META_BOX,
__( 'Old URL Redirect', 'mi11er-utility' ),

Avoid variables with short names like $id. Configured minimum length is 3.
Open

$id = (int) $wpdb->get_var( $wpdb->prepare(

The method template_redirect_action is not named in camelCase.
Open

public function template_redirect_action() {
global $wpdb;
 
if ( ! is_404() ) {
return;

The method old_url_redirect_meta_box is not named in camelCase.
Open

public function old_url_redirect_meta_box( $post ) {
?>
<ul>
<?php foreach ( get_post_meta( $post->ID, self::META_FIELD, false ) as $value ) : ?>
<li><?php echo esc_html( $value ); ?></li>

The method add_meta_boxes_action is not named in camelCase.
Open

function add_meta_boxes_action( $post_type, $post ) {
if ( ! empty( get_post_meta( $post->ID, self::META_FIELD, false ) ) ) {
add_meta_box(
self::META_BOX,
__( 'Old URL Redirect', 'mi11er-utility' ),
Category
Status