Showing 50 of 50 total issues
File lcp-catlist.php
has 452 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
define( 'LCP_PATH', plugin_dir_path( __FILE__ ) );
require_once ( LCP_PATH . 'lcp-thumbnail.php' );
require_once ( LCP_PATH . 'lcp-parameters.php' );
require_once ( LCP_PATH . 'lcp-utils.php' );
Method default_params
has 138 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function default_params(){
if (self::$default_params === null) {
self::$default_params = array(
'id' => '0',
'name' => '',
Function current_category
has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring. Open
public function current_category($mode, $ids='') {
// Only single post pages with assigned category and
// category archives have a 'current category',
// in all other cases no posts should be returned. (#69)
- 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 list_category_posts_options
has 126 lines of code (exceeds 25 allowed). Consider refactoring. Open
function list_category_posts_options() {
if ( !current_user_can( 'manage_options' ) ) {
wp_die( __( 'You do not have sufficient permissions to access this page.' ) );
}
?>
CatList
has 37 functions (exceeds 20 allowed). Consider refactoring. Open
class CatList{
private $params = array();
private $lcp_category_id = 0;
private $page = 1;
private $posts_count = 0;
Function get_query_params
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
public function get_query_params($params){
$this->params = $params;
# Essential parameters:
$args = array(
'numberposts' => $params['numberposts'],
- 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
CatListDisplayer
has 31 functions (exceeds 20 allowed). Consider refactoring. Open
class CatListDisplayer {
public $catlist;
private $wrapper;
private $templater;
private $params = array();
Function get_custom_fields
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
public function get_custom_fields($custom_key, $post_id) {
if ($this->utils->lcp_not_empty('customfield_display')) {
$lcp_customs = array();
//Doesn't work for many custom fields when having spaces:
- 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 widget
has 82 lines of code (exceeds 25 allowed). Consider refactoring. Open
function widget($args, $instance) {
global $post;
/* Since WP 4.9 global $post is nullified in text widgets
* when is_singular() is false. It should also be nullified in LCP
* widgets, otherwise the plugin will mark the last post of the loop
Method get_query_params
has 74 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function get_query_params($params){
$this->params = $params;
# Essential parameters:
$args = array(
'numberposts' => $params['numberposts'],
Function content_getter
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
private function content_getter($type, $post, $tag = null, $css_class = null) {
// Shortcode parameters take precedence over function arguments
// for tags and classes. 'posts_morelink_tag' param doesn't exist
if ($type !== 'posts_morelink') $tag = $this->params[$type . '_tag'] ?: $tag;
$css_class = $this->params[$type . '_class'] ?: $css_class;
- 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_thumbnail
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
public function get_thumbnail($single, $thumbnail, $thumbnail_size, $force_thumbnail, $lcp_thumb_class = null){
$lcp_thumbnail = null;
if( $thumbnail == 'yes' ){
$lcp_thumbnail = '';
- 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 get_pagination
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function get_pagination($params){
if (LcpUtils::lcp_show_pagination($params['pagination'])){
$lcp_paginator = '';
$pages_count = ceil (
$params['posts_count'] /
Function get_pagination
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
public function get_pagination($params){
if (LcpUtils::lcp_show_pagination($params['pagination'])){
$lcp_paginator = '';
$pages_count = ceil (
$params['posts_count'] /
- 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
File lcp-widget-form.php
has 267 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* List Category Posts sidebar widget form for Appearance > Widgets.
* @author fernando@picandocodigo.net
*/
Method content_getter
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function content_getter($type, $post, $tag = null, $css_class = null) {
// Shortcode parameters take precedence over function arguments
// for tags and classes. 'posts_morelink_tag' param doesn't exist
if ($type !== 'posts_morelink') $tag = $this->params[$type . '_tag'] ?: $tag;
$css_class = $this->params[$type . '_class'] ?: $css_class;
Function get_excerpt
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
public function get_excerpt($single) {
if (!empty( $this->params['excerpt']) &&
($this->params['excerpt']=='yes' || $this->params['excerpt']=='full')) {
if($single->post_excerpt == "" ||
- 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_category_link
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
public function get_category_link() {
if(($this->params['catlink'] == 'yes' ||
$this->params['catname'] == 'yes') &&
$this->lcp_category_id != 0){
// Check for one id or several:
- 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 get_thumbnail
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function get_thumbnail($single, $thumbnail, $thumbnail_size, $force_thumbnail, $lcp_thumb_class = null){
$lcp_thumbnail = null;
if( $thumbnail == 'yes' ){
$lcp_thumbnail = '';
Function create_date_query_args
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function create_date_query_args($args, $params) {
$date_query = array();
// Booleans to track which subarrays should be created.
$after = false;
$before = false;
- 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"