Showing 16 of 2,470 total issues
Function run_queue
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
public function run_queue() {
$database = $this->cargo->make( 'database' );
$pusher = $this->cargo->make( 'pusher' );
foreach ( $database->all() as $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 prepare_meta
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
protected function prepare_meta( $object_id, $meta ) {
if ( ! is_array( $meta ) ) {
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
Method create_item
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function create_item( $menu, $parent_id, $post ) {
$item = [];
$type = get_post_meta( $post->ID, '_menu_item_type', true );
switch ( $type ) {
Method prepare_meta
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function prepare_meta( $object_id, $meta ) {
if ( ! is_array( $meta ) ) {
return [];
}
Method send
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function send( $data ) {
$options = $this->cargo->config( 'pusher.http', ['url' => ''] );
$options = is_array( $options ) ? $options : ['url' => ''];
$json = $this->to_json( $data );
Function config
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function config( string $key, $default = null, array $source = [] ) {
if ( isset( $source[$key] ) ) {
return $source[$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 push_post_or_term
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function push_post_or_term( $id, $post = null ) {
// Check if there was a multisite switch before.
if ( is_multisite() && ms_is_switched() ) {
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 __construct
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function __construct() {
$menus = wp_get_nav_menus();
$result = [];
// Get registered nav manues and nav menu locations.
- 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 $res;
Avoid too many return
statements within this method. Open
return $res;
Avoid too many return
statements within this method. Open
return false;
Function __construct
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function __construct( $post ) {
// Bail if empty.
if ( empty( $post ) ) {
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_terms
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected function get_terms( $post ) {
$result = [];
$taxonomies = get_object_taxonomies( $post );
foreach ( $taxonomies as $taxonomy ) {
- 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 push_delete_post_or_term
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function push_delete_post_or_term( $id, $taxonomy = '' ) {
// Check if there was a multisite switch before.
if ( is_multisite() && ms_is_switched() ) {
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 modify_preview_link
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function modify_preview_link( $link, $post ) {
if ( empty( $_POST ) ) {
return $link;
}
- 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 push_trash_post
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function push_trash_post( $new_status, $old_status, $post ) {
// Check if there was a multisite switch before.
if ( is_multisite() && ms_is_switched() ) {
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"