Showing 156 of 160 total issues
Function _setupRepeatable
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
_setupRepeatable: function( selector ) {
var self = WPDLibFieldManager;
var $fields = this._getJQuery( selector );
$fields.each(function() {
Function _setupRepeatable
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
_setupRepeatable: function( selector ) {
var self = WPDLibFieldManager;
var $fields = this._getJQuery( selector );
$fields.each(function() {
Function parse
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public function parse( $val, $formatted = false ) {
if ( 'url' === $this->args['store'] ) {
$val = FieldManager::format( $val, 'url', 'input' );
} else {
$val = absint( $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
Function get_components_results
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
private static function get_components_results( $component_path, $current_children, $class_path_children ) {
$results = array();
if ( '*' == $component_path[0] ) {
if ( isset( $component_path[1] ) ) {
- 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 15 (exceeds 5 allowed). Consider refactoring. Open
public function validate( $val = null ) {
if ( ! $val ) {
if ( 'url' === $this->args['store'] ) {
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 get
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public static function get( $component_path, $class_path = '', $single = false ) {
$component_path = explode( '.', $component_path, 2 );
$class_path = explode( '.', $class_path, 2 );
$toplevel_components = 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 __construct
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public function __construct( $type, $args ) {
$this->type = $type;
$this->args = wp_parse_args( $args, array(
'id' => '',
'name' => '',
- 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 add
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public static function add( $component ) {
if ( self::is_too_late() ) {
return new UtilError( 'too_late_component', sprintf( __( 'Components must not be added later than the %s hook.', 'wpdlib' ), '<code>init</code>' ), '', self::$current_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
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function parse( $val, $formatted = false ) {
if ( 'coords' === $this->args['store'] ) {
$val = explode( '|', $val );
if ( 2 !== count( $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 __construct
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function __construct( $type, $args ) {
$args = wp_parse_args( $args, array(
'repeatable' => array(),
) );
if ( ! is_array( $args['repeatable'] ) ) {
- 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_bool
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
private static function parse_bool( $value ) {
if ( is_int( $value ) ) {
if ( $value > 0 ) {
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 init
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
init: function() {
var self = WPDLibFieldManager;
self.select2_args = {
width: 'element',
Function init
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
init: function() {
var self = WPDLibFieldManager;
self.select2_args = {
width: 'element',
Method verify_mime_types
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function verify_mime_types( $accepted_types ) {
if ( 'all' === $accepted_types ) {
return array();
}
Function add
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function add( $component ) {
if ( ComponentManager::is_too_late() ) {
return new UtilError( 'too_late_component', sprintf( __( 'Components must not be added later than the %s hook.', 'wpdlib' ), '<code>init</code>' ), '', 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 display_item
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
protected function display_item( $value, $label, $single_type, $id, $name, $current = '', $echo = true ) {
$option_atts = array(
'value' => $value,
'selected' => $this->is_value_checked_or_selected( $current, $value ),
);
- 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_dependency_info
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public static function get_dependency_info( $dependency, $field = '' ) {
$bower_file = self::get_base_dir() . '/assets/vendor/' . $dependency . '/.bower.json';
if ( ! file_exists( $bower_file ) ) {
$bower_file = self::get_base_dir() . '/assets/vendor/' . $dependency . '/bower.json';
}
- 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 maybe_generate_additional_item_output
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
protected function maybe_generate_additional_item_output( $id, $data, $checked = false ) {
$output = $class = $label = '';
if ( isset( $data['image'] ) || isset( $data['color'] ) ) {
$output = '<div id="' . $id . '-asset"';
- 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 exists
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public static function exists( $slug, $class, $check_slug = '' ) {
if ( ! isset( self::$component_finder[ $class ] ) ) {
self::$component_finder[ $class ] = 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
Method display
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function display( $val, $echo = true ) {
if ( ! is_array( $val ) ) {
$val = array();
}