Showing 156 of 160 total issues
Function is_valid_slug
has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring. Open
public function is_valid_slug( $parent = null ) {
if ( $this->valid_slug === null ) {
$globalnames = $this->supports_globalslug();
if ( $globalnames !== true ) {
if ( $globalnames !== 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"
Further reading
File Manager.php
has 385 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* WPDLib\FieldTypes\Manager class
*
* @package WPDLib
Function validate
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
public function validate( $val = null ) {
$format = 'float';
$zero = 0.0;
if ( is_int( $this->args['step'] ) ) {
$format = 'int';
- 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 format_item
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
protected function format_item( $val, $args = array() ) {
$skip_formatting = false;
if ( isset( $this->args['options'][ $val ] ) ) {
if ( is_array( $this->args['options'][ $val ] ) ) {
- 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 Media.php
has 328 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* WPDLib\FieldTypes\Media class
*
* @package WPDLib
Function parse
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
public function parse( $val, $formatted = false ) {
$parsed = array();
$items_formatted = false;
if ( $formatted ) {
$items_formatted = array( 'mode' => 'text', 'list' => true );
- 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 validate
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
public function validate( $val = null ) {
if ( ! $val || ! is_array( $val ) ) {
return array();
}
- 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 fields.js
has 306 lines of code (exceeds 250 allowed). Consider refactoring. Open
( function( $ ) {
if ( typeof _wpdlib_data === 'undefined' ) {
console.error( 'WPDLib data object not found' );
}
File fields.js
has 306 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*!
* WPDLib (https://github.com/felixarntz/wpdlib/)
* By Felix Arntz (https://leaves-and-love.net)
* Licensed under GNU General Public License v3 (http://www.gnu.org/licenses/gpl-3.0.html)
*/
Function get_dependencies_and_script_vars
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
public static function get_dependencies_and_script_vars( $fields = array() ) {
$dependencies = array();
$script_vars = array();
foreach ( $fields as $field ) {
- 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 make_html_attributes
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
public static function make_html_attributes( $atts, $html5 = true, $echo = true ) {
$output = '';
$bool_atts = array_filter( $atts, 'is_bool' );
- 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
Manager
has 26 functions (exceeds 20 allowed). Consider refactoring. Open
final class Manager {
/**
* Status whether the class has been initialized.
*
Function validate
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
public function validate( $parent = null ) {
if ( null !== $parent ) {
if ( count( $this->parents ) > 0 && ! $this->supports_multiparents() ) {
return new UtilError( 'no_multiparent_component', sprintf( __( 'The component %1$s of class %2$s already has a parent assigned and is not a multiparent component.', 'wpdlib' ), $this->slug, get_class( $this ) ), '', ComponentManager::get_scope() );
}
- 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 parse_multi
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
protected function parse_multi( $val, $formatted = false ) {
$parsed = array();
if ( $formatted ) {
if ( ! is_array( $formatted ) ) {
$formatted = array();
- 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 untranslate_replace
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
protected function untranslate_replace( $matches ) {
$term = $matches[0];
if ( $key = array_search( $term, self::$locale['weekday_initial'] ) ) {
if ( $key = array_search( $key, self::$locale['weekday'] ) ) {
- 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 display
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
public function display( $val, $echo = true ) {
$args = $this->args;
$args['name'] = $this->get_sanitized_name();
$args = array_merge( $args, $this->data_atts );
- 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 validate
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
public function validate( $val = null ) {
global $wp_locale;
if ( ! $val ) {
return '';
- 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 verify_mime_types
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
protected function verify_mime_types( $accepted_types ) {
if ( 'all' === $accepted_types ) {
return array();
}
- 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_extension
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
protected function check_extension( $extension, $accepted_types = 'all' ) {
if ( 'all' == $accepted_types || ! $accepted_types ) {
return true;
}
- 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 validate_multi
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
protected function validate_multi( $val = null ) {
if ( ! $val ) {
return array();
}
- 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"