mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-07 19:54:15 +08:00
🎨 Update code style and comment
This commit is contained in:
parent
6808c5f060
commit
dab2127a64
1 changed files with 7 additions and 6 deletions
|
@ -64,13 +64,14 @@ class PartnerAttribution {
|
||||||
*
|
*
|
||||||
* @param string $installation_path The installation path used to determine the BN Code.
|
* @param string $installation_path The installation path used to determine the BN Code.
|
||||||
*/
|
*/
|
||||||
public function initialize_bn_code( string $installation_path ): void {
|
public function initialize_bn_code( string $installation_path ) : void {
|
||||||
$selected_bn_code = $this->bn_codes[ $installation_path ] ?? false;
|
$selected_bn_code = $this->bn_codes[ $installation_path ] ?? '';
|
||||||
|
|
||||||
if ( get_option( $this->bn_code_option_name ) || ! $selected_bn_code ) {
|
if ( ! $selected_bn_code || get_option( $this->bn_code_option_name ) ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This option is permanent and should not change.
|
||||||
update_option( $this->bn_code_option_name, $selected_bn_code );
|
update_option( $this->bn_code_option_name, $selected_bn_code );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,10 +80,10 @@ class PartnerAttribution {
|
||||||
*
|
*
|
||||||
* @return string The stored BN Code, or the default value if no path is detected.
|
* @return string The stored BN Code, or the default value if no path is detected.
|
||||||
*/
|
*/
|
||||||
public function get_bn_code(): string {
|
public function get_bn_code() : string {
|
||||||
$bn_code = get_option( $this->bn_code_option_name, $this->default_bn_code ) ?? $this->default_bn_code;
|
$bn_code = (string) ( get_option( $this->bn_code_option_name, $this->default_bn_code ) ?? $this->default_bn_code );
|
||||||
|
|
||||||
if ( ! in_array( $bn_code, $this->bn_codes, true ) && $bn_code !== $this->default_bn_code ) {
|
if ( ! in_array( $bn_code, $this->bn_codes, true ) ) {
|
||||||
return $this->default_bn_code;
|
return $this->default_bn_code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue