mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
Fix psalm
This commit is contained in:
parent
fc89021df4
commit
651099705a
5 changed files with 58 additions and 40 deletions
|
@ -55,10 +55,12 @@ class PayerFactory {
|
|||
$national_number = preg_replace( '/[^0-9]/', '', $national_number );
|
||||
$national_number = substr( $national_number, 0, 14 );
|
||||
|
||||
$phone = new PhoneWithType(
|
||||
'HOME',
|
||||
new Phone( $national_number )
|
||||
);
|
||||
if ( $national_number ) {
|
||||
$phone = new PhoneWithType(
|
||||
'HOME',
|
||||
new Phone( $national_number )
|
||||
);
|
||||
}
|
||||
}
|
||||
return new Payer(
|
||||
new PayerName(
|
||||
|
@ -91,10 +93,12 @@ class PayerFactory {
|
|||
$national_number = preg_replace( '/[^0-9]/', '', $national_number );
|
||||
$national_number = substr( $national_number, 0, 14 );
|
||||
|
||||
$phone = new PhoneWithType(
|
||||
'HOME',
|
||||
new Phone( $national_number )
|
||||
);
|
||||
if ( $national_number ) {
|
||||
$phone = new PhoneWithType(
|
||||
'HOME',
|
||||
new Phone( $national_number )
|
||||
);
|
||||
}
|
||||
}
|
||||
return new Payer(
|
||||
new PayerName(
|
||||
|
@ -176,10 +180,12 @@ class PayerFactory {
|
|||
if ( null !== $national_number ) {
|
||||
$national_number = substr( $national_number, 0, 14 );
|
||||
|
||||
$phone = new PhoneWithType(
|
||||
'HOME',
|
||||
new Phone( $national_number )
|
||||
);
|
||||
if ( $national_number ) {
|
||||
$phone = new PhoneWithType(
|
||||
'HOME',
|
||||
new Phone( $national_number )
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -74,7 +74,10 @@ class ApplicationContextRepository {
|
|||
|
||||
$parts = explode( '-', $locale );
|
||||
if ( count( $parts ) === 3 ) {
|
||||
return substr( $locale, 0, strrpos( $locale, '-' ) );
|
||||
$ret = substr( $locale, 0, strrpos( $locale, '-' ) );
|
||||
if ( false !== $ret ) {
|
||||
return $ret;
|
||||
}
|
||||
}
|
||||
|
||||
return 'en';
|
||||
|
|
|
@ -45,6 +45,8 @@ class CustomerRepository {
|
|||
}
|
||||
|
||||
$unique_id = substr( $this->prefix . strrev( uniqid() ), 0, self::CLIENT_ID_MAX_LENGTH );
|
||||
assert( is_string( $unique_id ) );
|
||||
|
||||
WC()->session->set( 'ppcp_guest_customer_id', $unique_id );
|
||||
|
||||
return $unique_id;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue