Function remove_block
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private function remove_block( $block, &$blocks, &$parent = null ) {
foreach ( $blocks as $index => &$_block ) {
if ( $_block === $block ) {
- 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_confirm_group
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private function get_confirm_group( $id, $blocks ) {
foreach ( $blocks as $index => $block ) {
if ( $block['innerBlocks'] ) {
- 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 find_block
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
private function find_block( $id, $blocks, $parent_index = null ) {
foreach ( $blocks as $index => $block ) {
if ( ! empty( $block['attrs']['id'] ) && $id === $block['attrs']['id'] ) {
- 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_add_required_block_fields
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function maybe_add_required_block_fields( $blocks, $location, $args ) {
$fields_to_require = $this->get_required_fields_for_location( $location, $args );
if ( empty( $fields_to_require ) ) {
return $blocks;
- 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_required_block_fields
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private function add_required_block_fields( $fields_to_require, $blocks, $location ) {
$blocks_to_add = array();
foreach ( $fields_to_require as $field_id => $block_to_add ) {
- 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"