From b6cfc6f2916e73dae5ab9630b8b30a398dd03fb5 Mon Sep 17 00:00:00 2001 From: Khan M Rashedun-Naby Date: Fri, 20 Apr 2018 01:06:25 +0600 Subject: [PATCH] Removed unnecessary else condition. --- includes/api/legacy/v3/class-wc-api-reports.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/includes/api/legacy/v3/class-wc-api-reports.php b/includes/api/legacy/v3/class-wc-api-reports.php index 2d591af9077..552fd253fda 100644 --- a/includes/api/legacy/v3/class-wc-api-reports.php +++ b/includes/api/legacy/v3/class-wc-api-reports.php @@ -317,13 +317,14 @@ class WC_API_Reports extends WC_API_Resource { */ protected function validate_request( $id = null, $type = null, $context = null ) { - if ( ! current_user_can( 'view_woocommerce_reports' ) ) { - - return new WP_Error( 'woocommerce_api_user_cannot_read_report', __( 'You do not have permission to read this report', 'woocommerce' ), array( 'status' => 401 ) ); - - } else { - + if ( current_user_can( 'view_woocommerce_reports' ) ) { return true; } + + return new WP_Error( + 'woocommerce_api_user_cannot_read_report', + __( 'You do not have permission to read this report', 'woocommerce' ), + array( 'status' => 401 ) + ); } }