Method the_posts_filter
has 29 lines of code (exceeds 25 allowed). Consider refactoring.
public function the_posts_filter( $posts, $wp_query ) {
$file_config = $this->get_config();
if ( false !== $file_config && $wp_query->is_main_query() && ! is_admin() ) {
$default_post = [
'post_author' => 1,
Method add_config
has 5 arguments (exceeds 4 allowed). Consider refactoring.
public function add_config( $file, $rewrite, $template, $prevent_slash = true, $post = [] ) {
The method add_config has a boolean flag argument $prevent_slash, which is a certain sign of a Single Responsibility Principle violation.
public function add_config( $file, $rewrite, $template, $prevent_slash = true, $post = [] ) {
Avoid assigning values to variables in if clauses and the like (line '106', column '18').
public function template_include_filter( $template ) {
if ( false !== $file_config = $this->get_config() ) {
return $file_config['template'];
}
Avoid unused parameters such as '$requested_url'.
public function redirect_canonical_filter( $redirect_url, $requested_url ) {
The parameter $prevent_slash is not named in camelCase.
public function add_config( $file, $rewrite, $template, $prevent_slash = true, $post = [] ) {
$this->_files[] = [
'file' => $file,
'rewrite' => $rewrite,
'template' => $template,
The class File_Handler is not named in CamelCase.
class File_Handler implements Plugin_Interface
{
/**
* List of files that this plugin will handle.
*
The parameter $requested_url is not named in camelCase.
public function redirect_canonical_filter( $redirect_url, $requested_url ) {
if ( false !== $this->get_config() && $this->get_config()['prevent_slash'] ) {
return false;
}
The parameter $wp_query is not named in camelCase.
public function the_posts_filter( $posts, $wp_query ) {
$file_config = $this->get_config();
if ( false !== $file_config && $wp_query->is_main_query() && ! is_admin() ) {
$default_post = [
'post_author' => 1,
The parameter $redirect_url is not named in camelCase.
public function redirect_canonical_filter( $redirect_url, $requested_url ) {
if ( false !== $this->get_config() && $this->get_config()['prevent_slash'] ) {
return false;
}
The property $_files is not named in camelCase.
class File_Handler implements Plugin_Interface
{
/**
* List of files that this plugin will handle.
*
The method redirect_canonical_filter is not named in camelCase.
public function redirect_canonical_filter( $redirect_url, $requested_url ) {
if ( false !== $this->get_config() && $this->get_config()['prevent_slash'] ) {
return false;
}
The method template_include_filter is not named in camelCase.
public function template_include_filter( $template ) {
if ( false !== $file_config = $this->get_config() ) {
return $file_config['template'];
}
The method get_config is not named in camelCase.
public function get_config() {
$file_key = get_query_var( 'mu_file_handler', false );
if ( false !== $file_key && array_key_exists( $file_key, $this->_files ) ) {
return $this->_files[ $file_key ];
}
The method the_posts_filter is not named in camelCase.
public function the_posts_filter( $posts, $wp_query ) {
$file_config = $this->get_config();
if ( false !== $file_config && $wp_query->is_main_query() && ! is_admin() ) {
$default_post = [
'post_author' => 1,
The method init_action is not named in camelCase.
public function init_action() {
/**
* Fires on WordPress init, other themes and plugins to use this to handle their files.
*
* @param File_Handler $this File_Handler instance.
The method add_config is not named in camelCase.
public function add_config( $file, $rewrite, $template, $prevent_slash = true, $post = [] ) {
$this->_files[] = [
'file' => $file,
'rewrite' => $rewrite,
'template' => $template,
There are no issues that match your filters.