includes/cli/class-wc-cli-runner.php
Function register_route_commands
has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring. Open
Open
private static function register_route_commands( $rest_command, $route, $route_data, $command_args = array() ) {
// Define IDs that we are looking for in the routes (in addition to id)
// so that we can pass it to the rest command, and use it here to generate documentation.
$supported_ids = array(
'product_id' => __( 'Product ID.', 'woocommerce' ),
- 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 register_route_commands
has 127 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private static function register_route_commands( $rest_command, $route, $route_data, $command_args = array() ) {
// Define IDs that we are looking for in the routes (in addition to id)
// so that we can pass it to the rest command, and use it here to generate documentation.
$supported_ids = array(
'product_id' => __( 'Product ID.', 'woocommerce' ),
Function after_wp_load
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
Open
public static function after_wp_load() {
global $wp_rest_server;
$wp_rest_server = new WP_REST_Server();
do_action( 'rest_api_init', $wp_rest_server );
- 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 after_wp_load
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public static function after_wp_load() {
global $wp_rest_server;
$wp_rest_server = new WP_REST_Server();
do_action( 'rest_api_init', $wp_rest_server );