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
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
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 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 ) {
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 );
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 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 parse_template
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
protected function parse_template( $val, $template, $before = '', $after = '' ) {
$output = '';
if ( ! $this->is_empty( $val ) ) {
$output .= $before;
- 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"