MatthewMi11er/wordpress-plugin-mi11er-utility

View on GitHub
includes/mi11er-utility/class-ap-style.php

Summary

Maintainability
A
35 mins
Test Coverage

Showing 27 of 27 total issues

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

protected function _format_time( $the_time ) {
 
$time_parts = explode( '|', $the_time );
 
// Reformat to noon and midnight.
Severity: Minor
Found in includes/mi11er-utility/class-ap-style.php - About 35 mins to fix

Avoid using undefined variables such as '$date_parts' which will lead to PHP notices.
Open

if ( '00' === $date_parts[2] ) {

Avoid using undefined variables such as '$date_parts' which will lead to PHP notices.
Open

return $date_parts[1] . ' ' . $meridian;

The method _format_time uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

} else {
$meridian = 'p.m.';
}

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

protected function _year_string( $y ) {

The parameter $the_date is not named in camelCase.
Open

function get_the_modified_date_filter( $the_date, $d = '' ) {
 
if ( self::AP_STYLE !== $d ) {
return $the_date;
}

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

function get_the_modified_date_filter( $the_date, $d = '' ) {

The parameter $the_time is not named in camelCase.
Open

function get_the_modified_time_filter( $the_time, $d = '' ) {
 
if ( self::AP_STYLE !== $d ) {
return $the_time;
}

The parameter $the_date is not named in camelCase.
Open

public function get_the_date_filter( $the_date, $d = '', $post = null ) {
 
if ( self::AP_STYLE !== $d ) {
return $the_date;
}

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

protected function _month_string( $m ) {

The parameter $the_time is not named in camelCase.
Open

protected function _format_time( $the_time ) {
 
$time_parts = explode( '|', $the_time );
 
// Reformat to noon and midnight.

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

public function get_the_time_filter( $the_time, $d = '', $post = null ) {

The class Ap_Style is not named in CamelCase.
Open

class Ap_Style implements Plugin_Interface
{
 
/**
* Format Strings

The parameter $the_date is not named in camelCase.
Open

protected function _format_date( $the_date ) {
 
$date_parts = explode( '|', $the_date );
 
$month = $this->_month_string( $date_parts[1] );

The parameter $the_time is not named in camelCase.
Open

public function get_the_time_filter( $the_time, $d = '', $post = null ) {
 
if ( self::AP_STYLE !== $d ) {
return $the_time;
}

The parameter $the_value is not named in camelCase.
Open

protected function _capitalization( $the_value ) {
 
if ( ( ( 'noon' === $the_value || 'midnight' === $the_value ) && self::CAPITALIZE_NOON ) || ( 'today' === $the_value && self::CAPITALIZE_TODAY ) ) {
return ucfirst( $the_value );
}

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

public function get_the_date_filter( $the_date, $d = '', $post = null ) {

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

function get_the_modified_time_filter( $the_time, $d = '' ) {

The method get_the_time_filter is not named in camelCase.
Open

public function get_the_time_filter( $the_time, $d = '', $post = null ) {
 
if ( self::AP_STYLE !== $d ) {
return $the_time;
}

The method _year_string is not named in camelCase.
Open

protected function _year_string( $y ) {
 
if ( date( 'Y' ) !== $y || self::USE_YEAR ) {
return $y;
}

The method _format_time is not named in camelCase.
Open

protected function _format_time( $the_time ) {
 
$time_parts = explode( '|', $the_time );
 
// Reformat to noon and midnight.

The method _month_string is not named in camelCase.
Open

protected function _month_string( $m ) {
$ap_months = [
'01' => 'Jan.',
'02' => 'Feb.',
'03' => 'March',

The method _format_date is not named in camelCase.
Open

protected function _format_date( $the_date ) {
 
$date_parts = explode( '|', $the_date );
 
$month = $this->_month_string( $date_parts[1] );

The method get_the_date_filter is not named in camelCase.
Open

public function get_the_date_filter( $the_date, $d = '', $post = null ) {
 
if ( self::AP_STYLE !== $d ) {
return $the_date;
}

The method get_the_modified_date_filter is not named in camelCase.
Open

function get_the_modified_date_filter( $the_date, $d = '' ) {
 
if ( self::AP_STYLE !== $d ) {
return $the_date;
}

The method get_the_modified_time_filter is not named in camelCase.
Open

function get_the_modified_time_filter( $the_time, $d = '' ) {
 
if ( self::AP_STYLE !== $d ) {
return $the_time;
}

The method _capitalization is not named in camelCase.
Open

protected function _capitalization( $the_value ) {
 
if ( ( ( 'noon' === $the_value || 'midnight' === $the_value ) && self::CAPITALIZE_NOON ) || ( 'today' === $the_value && self::CAPITALIZE_TODAY ) ) {
return ucfirst( $the_value );
}
Category
Status