Showing 156 of 191 total issues
Method create_item
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function create_item( $request ) {
$user_id = (int) $request['id'];
$post_id = (int) $request['post_id'];
Method get_schema
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function get_schema( $schema, $collate ) {
global $wpdb;
$schema .= "
Method sql_where
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function sql_where() {
global $wpdb;
$sql = 'WHERE 1';
Method deliver
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function deliver( $args ) {
$start = microtime( true );
$payload = $this->get_payload( $args );
Method handle_webhook_upsert
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function handle_webhook_upsert() {
$data = array(
'name' => llms_filter_input_sanitize_string( INPUT_POST, 'llms_rest_webhook_name' ),
'status' => llms_filter_input_sanitize_string( INPUT_POST, 'llms_rest_webhook_status' ),
Function delivery_after
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
protected function delivery_after( $delivery_id, $req_args, $res, $duration ) {
// Parse response.
if ( is_wp_error( $res ) ) {
$res_code = $res->get_error_code();
- 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_payload
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
protected function get_payload( $args ) {
// Switch current user to the user who created the webhook.
$current_user = get_current_user_id();
wp_set_current_user( $this->get( 'user_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 check_roles_permissions
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
protected function check_roles_permissions( $request ) {
global $wp_roles;
$schema = $this->get_item_schema();
- 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_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 exports
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function( source, options ) {
const
opts = Object.assign( {
indent: ' '
Method prepare_object_for_response
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function prepare_object_for_response( $lesson, $request ) {
$data = parent::prepare_object_for_response( $lesson, $request );
// Audio Embed.
Method get_objects_query
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function get_objects_query( $prepared, $request ) {
if ( 'id' === $prepared['orderby'] ) {
$prepared['orderby'] = 'ID';
} elseif ( 'registered_date' === $prepared['orderby'] ) {
Method check_roles_permissions
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function check_roles_permissions( $request ) {
global $wp_roles;
$schema = $this->get_item_schema();
Method get_payload
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function get_payload( $args ) {
// Switch current user to the user who created the webhook.
$current_user = get_current_user_id();
wp_set_current_user( $this->get( 'user_id' ) );
Method update_additional_data
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function update_additional_data( $object_id, $prepared, $request ) {
$object = $this->get_object( $object_id );
if ( is_wp_error( $object ) ) {
Function prepare_item_for_database
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
protected function prepare_item_for_database( $request ) {
$prepared_item = parent::prepare_item_for_database( $request );
$schema = $this->get_item_schema();
- 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 update_additional_object_fields
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
protected function update_additional_object_fields( $lesson, $request, $schema, $prepared_item, $creating = true ) {
$error = new WP_Error();
$to_set = 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 prepare_links
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
protected function prepare_links( $object, $request ) {
$links = parent::prepare_links( $object, $request );
$object_id = $object->get( '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 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
Function prepare_items_query
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
protected function prepare_items_query( $prepared_args = array(), $request = null ) {
$query_args = array();
foreach ( $prepared_args as $key => $value ) {
- 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"