Showing 50 of 50 total issues
Function get_post_title
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function get_post_title($single, $tag = null, $css_class = null,
$link = true, $link_current = true) {
// Don't do anything if no_post_titles is specified.
if ('yes' === $this->params['no_post_titles']) {
- 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 widget
has a Cognitive Complexity of 12 (exceeds 5 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
- 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_category_link
has 32 lines of code (exceeds 25 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:
Method lcp_page_link
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function lcp_page_link($page, $current_page, $lcp_instance, $bookmark, $char = null){
$link = '';
if ($page == $current_page){
$link = "<li class='lcp_currentpage'>" . esc_html($current_page) . '</li>';
Function get_content
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function get_content($single) {
if (isset($this->params['content']) &&
($this->params['content'] =='yes' || $this->params['content'] == 'full') &&
$single->post_content){
// get_extended - get content split by <!--more-->
- 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 lcp_page_link
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
private function lcp_page_link($page, $current_page, $lcp_instance, $bookmark, $char = null){
$link = '';
if ($page == $current_page){
$link = "<li class='lcp_currentpage'>" . esc_html($current_page) . '</li>';
- 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 current_category
has 30 lines of code (exceeds 25 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)
Function check_customfield_compare
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private function check_customfield_compare($params, &$meta_query) {
if ($params['customfield_compare']) {
// customfield_compare=key,compare,value,type;key,compare,value,type...
$compare_queries = explode(';', $params['customfield_compare']);
- 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 check_multiple_taxonomies
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private function check_multiple_taxonomies( $params, &$tax_query ) {
// Multiple taxonomies support in the form
// taxonomies_or="tax1:{term1_1,term1_2};tax2:{term2_1,term2_2,term2_3}"
// taxonomies_and="tax1:{term1_1,term1_2};tax2:{term2_1,term2_2,term2_3}"
if ( !empty( $params[ 'taxonomies_or' ] ) ||
- 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_templates
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public static function get_templates() {
$templates = [];
$paths = self::get_template_paths();
foreach ($paths as $path) {
- 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 update
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
function update($new_instance, $old_instance) {
$instance = $old_instance;
$instance['title'] = strip_tags($new_instance['title']);
$instance['limit'] = strip_tags($new_instance['limit']);
$instance['orderby'] = strip_tags($new_instance['orderby']);
Method get_post_title
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function get_post_title($single, $tag = null, $css_class = null,
$link = true, $link_current = true) {
// Don't do anything if no_post_titles is specified.
if ('yes' === $this->params['no_post_titles']) {
Method get_content
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function get_content($single) {
if (isset($this->params['content']) &&
($this->params['content'] =='yes' || $this->params['content'] == 'full') &&
$single->post_content){
// get_extended - get content split by <!--more-->
Method set_lcp_parameters
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function set_lcp_parameters(){
$args = LcpCategory::get_instance()->get_lcp_category([
'id' => $this->params['id'],
'name' => $this->params['name'],
'categorypage' => $this->params['categorypage'],
Function get_inner_tag
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function get_inner_tag($single, $parent, $tag, $css_class='') {
$class = $css_class;
$props = [];
if (is_object( $parent) && is_object($single) &&
$parent->ID === $single->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 check_current_terms
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
private function check_current_terms( $params, &$tax_query ) {
$currentterms = $params[ 'currentterms' ];
if ( $currentterms === 'yes' || $currentterms === 'all' ) {
$terms = $this->get_current_terms( $params[ 'taxonomy' ] );
- 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 list_category_posts_options
has a Cognitive Complexity of 8 (exceeds 5 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.' ) );
}
?>
- 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 lcp_title_limit
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private function lcp_title_limit( $lcp_post_title ){
if ( !empty($this->params['title_limit']) && $this->params['title_limit'] !== "0" ){
$title_limit = intval($this->params['title_limit']);
if( function_exists('mb_strlen') && function_exists('mb_substr') && mb_strlen($lcp_post_title) > $title_limit ){
$lcp_post_title = mb_substr($lcp_post_title, 0, $title_limit) . "…";
- 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 __construct
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function __construct($param) {
// Default plugin template.
$this->template_file = plugin_dir_path(__DIR__) . 'templates/default.php';
if (empty($param)) {
- 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 check_pagination
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private function check_pagination($args) {
if (LcpUtils::lcp_show_pagination($this->params['pagination'])) {
if(array_key_exists('QUERY_STRING', $_SERVER) && null !== $_SERVER['QUERY_STRING'] ) {
$query = $_SERVER['QUERY_STRING'];
if ($query !== '' && preg_match('/lcp_page' . preg_quote($this->instance) .
- 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"