mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-08-30 05:00:51 +08:00
Refactor conditionals
This commit is contained in:
parent
e1c8b223d2
commit
f93cfaa3e1
1 changed files with 7 additions and 12 deletions
|
@ -98,20 +98,15 @@ class ShippingFactory {
|
|||
public function from_paypal_response( \stdClass $data ): Shipping {
|
||||
$name = $data->name->full_name ?? null;
|
||||
|
||||
$address = null;
|
||||
if ( isset( $data->address ) ) {
|
||||
$address = $this->address_factory->from_paypal_response( $data->address );
|
||||
}
|
||||
$address = isset( $data->address )
|
||||
? $this->address_factory->from_paypal_response( $data->address )
|
||||
: null;
|
||||
|
||||
$contact_email = null;
|
||||
if ( isset( $data->email_address ) ) {
|
||||
$contact_email = $data->email_address;
|
||||
}
|
||||
$contact_email = $data->email_address ?? null;
|
||||
|
||||
$contact_phone = null;
|
||||
if ( isset( $data->phone_number->national_number ) ) {
|
||||
$contact_phone = new Phone( $data->phone_number->national_number );
|
||||
}
|
||||
$contact_phone = isset( $data->phone_number->national_number )
|
||||
? new Phone( $data->phone_number->national_number )
|
||||
: null;
|
||||
|
||||
$options = array_map(
|
||||
array( $this->shipping_option_factory, 'from_paypal_response' ),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue