Showing 160 of 160 total issues
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();
}
Method get_attachment_field
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function get_attachment_field( $id, $field = 'url' ) {
switch ( $field ) {
case 'id':
case 'ID':
return $id;
Method validate
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function validate( $val = null ) {
$format = 'float';
$zero = 0.0;
if ( is_int( $this->args['step'] ) ) {
$format = 'int';
Method display_item
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function display_item( $key, $values = array(), $echo = true ) {
$output = '<tr class="wpdlib-repeatable-row">';
$output .= '<td class="wpdlib-repeatable-number">';
if ( '{{' . 'KEY' . '}}' === $key ) {
Function _datetimeOnShow
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
_datetimeOnShow: function( ct, $input ) {
var helper = '';
if ( $input.attr( 'min' ) ) {
helper = $input.attr( 'min' ).split( ' ' );
if ( helper.length === 2 ) {
Function _datetimeOnShow
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
_datetimeOnShow: function( ct, $input ) {
var helper = '';
if ( $input.attr( 'min' ) ) {
helper = $input.attr( 'min' ).split( ' ' );
if ( helper.length === 2 ) {
Method parse
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function parse( $val, $formatted = false ) {
$parsed = array();
$items_formatted = false;
if ( $formatted ) {
$items_formatted = array( 'mode' => 'text', 'list' => true );
Method check_for_admin_page_func
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function check_for_admin_page_func( $slug ) {
if ( function_exists( 'add_' . $slug . '_page' ) ) {
switch ( $slug ) {
case 'dashboard':
return 'index.php';
Function object_array_merge_split
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
private static function object_array_merge_split( $arrs, $sort_by ) {
$sortables = array();
$nulls = array();
foreach ( $arrs as $arr ) {
- 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 create
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function create() {
foreach ( $this->get_children() as $menu_item ) {
if ( is_callable( array( $menu_item, 'add_to_menu' ) ) ) {
if ( 'none' == $this->slug ) {
$this->add_non_menu_page( $menu_item );
- 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_float
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
private static function format_float( $value, $mode = 'input', $args = array() ) {
$positive_only = isset( $args['positive_only'] ) ? (bool) $args['positive_only'] : false;
$formatted = self::parse_float( $value );
if ( $positive_only ) {
- 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_default_datetime_format
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
private static function get_default_datetime_format( $type, $mode = 'input' ) {
if ( 'output' === $mode ) {
if ( $type == 'date' ) {
return get_option( 'date_format' );
} elseif ( $type == 'time' ) {
- 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 11 (exceeds 5 allowed). Consider refactoring. Open
protected function display_item( $key, $values = array(), $echo = true ) {
$output = '<tr class="wpdlib-repeatable-row">';
$output .= '<td class="wpdlib-repeatable-number">';
if ( '{{' . 'KEY' . '}}' === $key ) {
- 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_single
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
protected function validate_single( $val = null ) {
if ( ! $val ) {
if ( count( $this->args['options'] ) > 0 ) {
return key( $this->args['options'] );
}
- 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 11 (exceeds 5 allowed). Consider refactoring. Open
public function display( $val, $echo = true ) {
if ( ! is_array( $val ) ) {
$val = 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 get_attachment_path
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
protected function get_attachment_path( $id, $mode = 'url', $size = false ) {
$url = wp_get_attachment_url( $id );
if ( $size ) {
$src = wp_get_attachment_image_src( $id, $size, false );
if ( is_array( $src ) ) {
- 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 11 (exceeds 5 allowed). Consider refactoring. Open
public function parse( $val, $formatted = false ) {
if ( $formatted ) {
$parsed = FieldManager::format( $val, 'html', 'input' );
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"