Skip to content
This repository has been archived by the owner on Nov 13, 2024. It is now read-only.

Commit

Permalink
Some phpcs stuff from the downstream repo.
Browse files Browse the repository at this point in the history
  • Loading branch information
georgestephanis committed Apr 30, 2024
1 parent 435b891 commit b9e4062
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 17 deletions.
7 changes: 3 additions & 4 deletions sift-decisions.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
// Load plugin translations so they are available even for the error admin notices.
add_action(
'init',
static function() {
static function () {
load_plugin_textdomain(
'sift-decisions',
false,
Expand All @@ -43,7 +43,7 @@ static function() {
if ( ! is_file( __DIR__ . '/vendor/autoload.php' ) ) {
add_action(
'admin_notices',
static function() {
static function () {
$message = __( 'It seems like <strong>Sift Decisions</strong> is corrupted. Please reinstall!', 'sift-decisions' );
$html_message = wp_sprintf( '<div class="error notice wpcomsp-scaffold-error">%s</div>', wpautop( $message ) );
echo wp_kses_post( $html_message );
Expand All @@ -53,7 +53,6 @@ static function() {
}
require_once __DIR__ . '/vendor/autoload.php';

require_once __DIR__ . '/src/SiftDecisions.php';
require_once __DIR__ . '/src/sift-decisions.php';

\WPCOMSpecialProjects\SiftDecisions\SiftDecisions::get_instance();

4 changes: 2 additions & 2 deletions src/inc/rest-api-webhooks.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ function decision_webhook_auth( \WP_REST_Request $request ) {
'debug',
'Unauthorized Sift Decision Request. Bad key: `' . $key . '`',
array(
'source' => 'sift-decisions'
'source' => 'sift-decisions',
)
);

Expand All @@ -61,7 +61,7 @@ function decision_webhook( \WP_REST_Request $request ) {
'info',
'Received Sift Decision: ' . wp_json_encode( $json ),
array(
'source' => 'sift-decisions'
'source' => 'sift-decisions',
)
);

Expand Down
2 changes: 1 addition & 1 deletion src/inc/wc-settings-tab.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ function test_api_credentials_result( $api_key = null, $account_id = null ) {
'error',
'Invalid API Credentials.',
array(
'source' => 'sift-decisions'
'source' => 'sift-decisions',
)
);
} else {
Expand Down
18 changes: 9 additions & 9 deletions src/inc/woocommerce-actions.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,8 @@ public static function login_failure( string $username, \WP_Error $error ) {
'$browser' => self::get_client_browser(), // alternately, `$app` for details of the app if not a browser.
'$username' => $username,
'$failure_reason' => $failure_reason,
'$ip' => self::get_client_ip(),
'$time' => intval( 1000 * microtime( true ) ),
'$ip' => self::get_client_ip(),
'$time' => intval( 1000 * microtime( true ) ),
)
);
}
Expand All @@ -150,8 +150,8 @@ public static function create_account( string $user_id ) {
'$user_email' => $user->email,
'$name' => $user->display_name,
'$phone' => $user ? get_user_meta( $user->user_id, 'billing_phone', true ) : null,
// '$referrer_user_id' => ??? -- required for detecting referral fraud, but non-standard to woocommerce.
// '$payment_methods' => self::get_customer_payment_methods( $user->ID ),
// '$referrer_user_id' => ??? -- required for detecting referral fraud, but non-standard to woocommerce.
// '$payment_methods' => self::get_customer_payment_methods( $user->ID ),
'$billing_address' => self::get_customer_address( $user->ID, 'billing' ),
'$shipping_address' => self::get_customer_address( $user->ID, 'shipping' ),
'$browser' => self::get_client_browser(),
Expand Down Expand Up @@ -184,8 +184,8 @@ public static function update_account( string $user_id, array $old_user_data ) {
'$user_email' => $user->email,
'$name' => $user->display_name,
'$phone' => $user ? get_user_meta( $user->user_id, 'billing_phone', true ) : null,
// '$referrer_user_id' => ??? -- required for detecting referral fraud, but non-standard to woocommerce.
// '$payment_methods' => self::get_customer_payment_methods( $user->ID ),
// '$referrer_user_id' => ??? -- required for detecting referral fraud, but non-standard to woocommerce.
// '$payment_methods' => self::get_customer_payment_methods( $user->ID ),
'$billing_address' => self::get_customer_address( $user->ID, 'billing' ),
'$shipping_address' => self::get_customer_address( $user->ID, 'shipping' ),
'$browser' => self::get_client_browser(),
Expand Down Expand Up @@ -380,11 +380,11 @@ public static function create_order( string $order_id, array $posted_data, \WC_O
'$session_id' => \WC()->session->get_customer_unique_id(),
'$order_id' => $order_id,
'$verification_phone_number'
=> $order->get_billing_phone(),
=> $order->get_billing_phone(),
'$amount' => intval( $order->get_total() * 1000000 ), // Gotta multiply it up to give an integer.
'$currency_code' => get_woocommerce_currency(),
'$billing_address' => self::get_order_address( $user->ID, 'billing' ),
// '$payment_methods' => array(),
// '$payment_methods' => array(),
'$shipping_address' => self::get_order_address( $user->ID, 'shipping' ),
'$items' => $items,
'$shipping_method' => $physical_or_electronic,
Expand Down Expand Up @@ -475,7 +475,7 @@ public static function send() {
'debug',
'Sent data: `' . wp_json_encode( $entry ) . '`',
array(
'source' => 'sift-decisions'
'source' => 'sift-decisions',
)
);
}
Expand Down
2 changes: 1 addition & 1 deletion src/SiftDecisions.php → src/sift-decisions.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public static function get_api_client() {
'error',
'Attempting to instantiate Sift API client, but missing `account_id` or `api_key`.',
array(
'source' => 'sift-decisions'
'source' => 'sift-decisions',
)
);

Expand Down

0 comments on commit b9e4062

Please sign in to comment.