includes/legacy/class-wc-legacy-api.php
Method handle_v2_rest_api_request
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private function handle_v2_rest_api_request() {
include_once( dirname( __FILE__ ) . '/api/v2/class-wc-api-exception.php' );
include_once( dirname( __FILE__ ) . '/api/v2/class-wc-api-server.php' );
include_once( dirname( __FILE__ ) . '/api/v2/interface-wc-api-handler.php' );
include_once( dirname( __FILE__ ) . '/api/v2/class-wc-api-json-handler.php' );
Method handle_v1_rest_api_request
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private function handle_v1_rest_api_request() {
// Include legacy required files for v1 REST API request.
include_once( dirname( __FILE__ ) . '/api/v1/class-wc-api-server.php' );
include_once( dirname( __FILE__ ) . '/api/v1/interface-wc-api-handler.php' );
Function handle_rest_api_requests
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
public function handle_rest_api_requests() {
global $wp;
if ( ! empty( $_GET['wc-api-version'] ) ) {
$wp->query_vars['wc-api-version'] = $_GET['wc-api-version'];
- 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"