Function update_additional_object_fields
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
protected function update_additional_object_fields( $access_plan, $request, $schema, $prepared_item, $creating = true ) {
$error = new WP_Error();
// Will contain the properties to set.
- 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
File class-llms-rest-access-plans-controller.php
has 358 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* REST Access Plans Controller
*
* @package LifterLMS_REST/Classes/Controllers
Method update_additional_object_fields
has 92 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function update_additional_object_fields( $access_plan, $request, $schema, $prepared_item, $creating = true ) {
$error = new WP_Error();
// Will contain the properties to set.
Method prepare_object_for_response
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function prepare_object_for_response( $access_plan, $request ) {
$data = parent::prepare_object_for_response( $access_plan, $request );
$context = $request->get_param( 'context' );
Function prepare_object_for_response
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
protected function prepare_object_for_response( $access_plan, $request ) {
$data = parent::prepare_object_for_response( $access_plan, $request );
$context = $request->get_param( 'context' );
- 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 unset_subordinate_props
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
private function unset_subordinate_props( &$to_set, $saved_props ) {
// Merge new properties to set and saved props.
$props = wp_parse_args( $to_set, $saved_props );
- 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_additional_object_fields
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
protected function update_additional_object_fields( $access_plan, $request, $schema, $prepared_item, $creating = true ) {
Function related_product_permissions_check
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private function related_product_permissions_check( $has_permissions, $request ) {
if ( llms_rest_is_authorization_required_error( $has_permissions ) ) {
// `id` required on "reading/updating", `post_id` required on "creating".
- 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"