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 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 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 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 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
Function get_info
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public static function get_info( $field = '' ) {
$composer_file = self::get_base_dir() . '/composer.json';
if ( ! file_exists( $composer_file ) ) {
if ( ! empty( $field ) ) {
return 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
Function register_hierarchy
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public static function register_hierarchy( $hierarchy, $toplevel = true ) {
foreach ( $hierarchy as $class => $children ) {
if ( $toplevel && ! in_array( $class, self::$hierarchy_toplevel ) ) {
self::$hierarchy_toplevel[] = $class;
}
- 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
Avoid too many return
statements within this method. Open
return $component;
Avoid too many return
statements within this method. Open
return new UtilError( 'no_valid_slug_component', sprintf( __( 'A component of class %1$s with slug %2$s already exists.', 'wpdlib' ), $component_class, $component->slug ), '', self::$current_scope );
Avoid too many return
statements within this method. Open
return self::merge_components( self::$components[ $component_class ][ $component->slug ], $component );
Avoid too many return
statements within this method. Open
return $info;
Avoid too many return
statements within this method. Open
return $info;