Function update_meta_cache
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
function update_meta_cache($meta_type, $object_ids) {
if ( empty( $meta_type ) || empty( $object_ids ) )
return false;
if ( ! $table = _get_meta_table($meta_type) )
- 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 update_meta_cache
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
function update_meta_cache($meta_type, $object_ids) {
if ( empty( $meta_type ) || empty( $object_ids ) )
return false;
if ( ! $table = _get_meta_table($meta_type) )
Function get_metadata
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
function get_metadata($meta_type, $object_id, $meta_key = '', $single = false) {
if ( !$meta_type )
return false;
$meta_cache = wp_cache_get($object_id, $meta_type . '_meta');
- 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 delete_metadata
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function delete_metadata($meta_type, $object_id, $meta_key, $meta_value = '', $delete_all = false) {
if ( !$meta_type || !$meta_key || (!$delete_all && ! (int)$object_id) )
return false;
if ( ! $table = _get_meta_table($meta_type) )
- 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 update_metadata
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function update_metadata($meta_type, $object_id, $meta_key, $meta_value, $prev_value = '') {
Method add_metadata
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function add_metadata($meta_type, $object_id, $meta_key, $meta_value, $unique = false) {
Method delete_metadata
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function delete_metadata($meta_type, $object_id, $meta_key, $meta_value = '', $delete_all = false) {
Avoid too many return
statements within this method. Open
return true;
Avoid too many return
statements within this method. Open
return array();
Avoid too many return
statements within this method. Open
return '';