mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 13:44:42 +08:00
Fix PHPcs errors
This commit is contained in:
parent
cd75b08e9e
commit
a4cb280fe3
2 changed files with 293 additions and 290 deletions
|
@ -39,7 +39,7 @@ return array(
|
|||
return new MetaBoxRenderer(
|
||||
$container->get( 'order-tracking.endpoint.controller' ),
|
||||
$container->get( 'order-tracking.allowed-shipping-statuses' ),
|
||||
$container->get( 'order-tracking.available-carriers' ),
|
||||
$container->get( 'order-tracking.available-carriers' )
|
||||
);
|
||||
},
|
||||
'order-tracking.allowed-shipping-statuses' => static function ( ContainerInterface $container ): array {
|
||||
|
@ -53,7 +53,7 @@ return array(
|
|||
$has_state = strpos( $wc_default_country, ':' );
|
||||
$selected_address = $has_state ? substr( $wc_default_country, 0, $has_state ) : $wc_default_country;
|
||||
$allowed_carriers = $container->get( 'order-tracking.allowed-carriers' );
|
||||
$selected_country_carriers = $allowed_carriers[$selected_address] ?? [];
|
||||
$selected_country_carriers = $allowed_carriers[ $selected_address ] ?? array();
|
||||
|
||||
return array(
|
||||
$selected_country_carriers,
|
||||
|
@ -62,17 +62,17 @@ return array(
|
|||
'name' => 'Other',
|
||||
'items' => array(
|
||||
'OTHER' => _x( 'Other', 'Name of carrier', 'woocommerce-paypal-payments' ),
|
||||
)
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
'order-tracking.is-paypal-order-edit-page' => static function ( ContainerInterface $container ): bool {
|
||||
$orderId = isset( $_GET['post'] ) ? (int)$_GET['post'] : '';
|
||||
if (empty($orderId)) {
|
||||
$order_id = isset( $_GET['post'] ) ? (int) $_GET['post'] : ''; // phpcs:ignore WordPress.Security.NonceVerification.Recommended
|
||||
if ( empty( $order_id ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$meta = get_post_meta($orderId, PayPalGateway::ORDER_ID_META_KEY, true);
|
||||
$meta = get_post_meta( $order_id, PayPalGateway::ORDER_ID_META_KEY, true );
|
||||
|
||||
return ! empty( $meta );
|
||||
},
|
||||
|
|
|
@ -111,12 +111,15 @@ class OrderTrackingEndpoint {
|
|||
$action === 'create' ? $this->add_tracking_information( $request_body, $order_id ) : $this->update_tracking_information( $data, $order_id );
|
||||
|
||||
$action_message = $action === 'create' ? 'created' : 'updated';
|
||||
$message = __("successfully {$action_message}",'woocommerce-paypal-payments');
|
||||
$message = sprintf(
|
||||
// translators: %1$s is the action message (created or updated).
|
||||
_x( 'successfully %1$s', 'tracking inof success message', 'woocommerce-paypal-payments' ),
|
||||
esc_html( $action_message )
|
||||
);
|
||||
|
||||
wp_send_json_success( array( 'message' => $message ) );
|
||||
return true;
|
||||
} catch ( Exception $error ) {
|
||||
wp_send_json_error( $error->getMessage(), 500 );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -132,7 +135,7 @@ class OrderTrackingEndpoint {
|
|||
$url = trailingslashit( $this->host ) . 'v1/shipping/trackers-batch';
|
||||
|
||||
$body = array(
|
||||
'trackers' => array($data)
|
||||
'trackers' => array( $data ),
|
||||
);
|
||||
|
||||
$args = array(
|
||||
|
@ -221,7 +224,7 @@ class OrderTrackingEndpoint {
|
|||
$status_code = (int) wp_remote_retrieve_response_code( $response );
|
||||
|
||||
if ( 200 !== $status_code ) {
|
||||
return [];
|
||||
return array();
|
||||
}
|
||||
|
||||
return array(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue