Skip to content

Commit

Permalink
phpcs fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
dimaspolohov@yandex.ru authored and dimaspolohov@yandex.ru committed Feb 21, 2024
1 parent 0540771 commit 8b5a61f
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 32 deletions.
10 changes: 5 additions & 5 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 4 additions & 5 deletions includes/Admin/MetaBoxes.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,14 @@ public function add_meta_boxes() {
? wc_get_page_screen_id( 'shop-order' )
: 'shop_order';

if(!empty($_REQUEST['id'])){
if ( ! empty( $_REQUEST['id'] ) ) {
$order_id = $_REQUEST['id'];
}elseif (!empty($_GET['post'])){
} elseif ( ! empty( $_GET['post'] ) ) {
$order_id = $_GET['post'];
}

if(!empty($order_id)){
$order = wc_get_order( $order_id );
if ( ! empty( $order_id ) ) {
$order = wc_get_order( $order_id );
if ( $order ) {
$order_data = $order->get_data();

Expand All @@ -74,7 +74,6 @@ public function add_meta_boxes() {
$subscription = $order->get_meta( '_reepay_subscription_handle' );
}


add_meta_box(
'reepay_checkout_customer',
__( 'Customer', 'reepay-checkout-gateway' ),
Expand Down
16 changes: 8 additions & 8 deletions includes/Functions/format.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,31 +47,31 @@ function rp_format_credit_card( string $cc ) {
function rp_clear_ordertext( string $string ) {
// Match Enclosed Alphanumeric Supplement
$regex_alphanumeric = '/[\x{1F100}-\x{1F1FF}]/u';
$clear_string = preg_replace($regex_alphanumeric, '', $string);
$clear_string = preg_replace( $regex_alphanumeric, '', $string );

// Match Miscellaneous Symbols and Pictographs
$regex_symbols = '/[\x{1F300}-\x{1F5FF}]/u';
$clear_string = preg_replace($regex_symbols, '', $clear_string);
$clear_string = preg_replace( $regex_symbols, '', $clear_string );

// Match Emoticons
$regex_emoticons = '/[\x{1F600}-\x{1F64F}]/u';
$clear_string = preg_replace($regex_emoticons, '', $clear_string);
$clear_string = preg_replace( $regex_emoticons, '', $clear_string );

// Match Transport And Map Symbols
$regex_transport = '/[\x{1F680}-\x{1F6FF}]/u';
$clear_string = preg_replace($regex_transport, '', $clear_string);
$clear_string = preg_replace( $regex_transport, '', $clear_string );

// Match Supplemental Symbols and Pictographs
$regex_supplemental = '/[\x{1F900}-\x{1F9FF}]/u';
$clear_string = preg_replace($regex_supplemental, '', $clear_string);
$clear_string = preg_replace( $regex_supplemental, '', $clear_string );

// Match Miscellaneous Symbols
$regex_misc = '/[\x{2600}-\x{26FF}]/u';
$clear_string = preg_replace($regex_misc, '', $clear_string);
$regex_misc = '/[\x{2600}-\x{26FF}]/u';
$clear_string = preg_replace( $regex_misc, '', $clear_string );

// Match Dingbats
$regex_dingbats = '/[\x{2700}-\x{27BF}]/u';
$clear_string = preg_replace($regex_dingbats, '', $clear_string);
$clear_string = preg_replace( $regex_dingbats, '', $clear_string );

return $clear_string;
}
Expand Down
2 changes: 1 addition & 1 deletion includes/Gateways/ReepayCheckout.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public function __construct() {
$this->failed_webhooks_email = $this->settings['failed_webhooks_email'] ?: $this->failed_webhooks_email;
$this->handle_failover = ! empty( $this->settings['handle_failover'] ) ?: $this->handle_failover;

if(!empty($this->settings['settle']) && is_array( $this->settings['settle'])){
if ( ! empty( $this->settings['settle'] ) && is_array( $this->settings['settle'] ) ) {
$this->settle = $this->settings['settle'];
}

Expand Down
12 changes: 6 additions & 6 deletions includes/Gateways/ReepayGateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -1389,13 +1389,13 @@ public function get_order_items( WC_Order $order, $only_not_settled = false ): a
if ( $order_item->get_product() && wcr_is_subscription_product( $order_item->get_product() ) ) {
$fee = $order_item->get_product()->get_meta( '_reepay_subscription_fee' );
if ( ! empty( $fee ) && ! empty( $fee['enabled'] ) && 'yes' === $fee['enabled'] ) {
$setup_fees[] = rp_clear_ordertext($order_item->get_product()->get_name()) . ' - ' . $fee['text'];
$setup_fees[] = rp_clear_ordertext( $order_item->get_product()->get_name() ) . ' - ' . $fee['text'];
}
$sub_amount_discount += floatval( $order_item->get_meta( '_line_discount' ) );
continue;
}

$price = $order->get_line_subtotal( $order_item, false, false );
$price = $order->get_line_subtotal( $order_item, false, false );
$this->log(
array(
'source' => 'Price',
Expand All @@ -1411,22 +1411,22 @@ public function get_order_items( WC_Order $order, $only_not_settled = false ): a
)
);

$tax = $price_with_tax - $price;
$tax = $price_with_tax - $price;
$this->log(
array(
'source' => 'Tax amount',
'result' => $tax,
)
);

$tax_percent = ( $tax > 0 && $price > 0 ) ? round( 100 / ( $price / $tax ) ) : 0;
$tax_percent = ( $tax > 0 && $price > 0 ) ? round( 100 / ( $price / $tax ) ) : 0;
$this->log(
array(
'source' => 'Tax percent',
'result' => $tax_percent,
)
);
$unit_price = round( ( $prices_incl_tax ? $price_with_tax : $price ) / $order_item->get_quantity(), 2 );
$unit_price = round( ( $prices_incl_tax ? $price_with_tax : $price ) / $order_item->get_quantity(), 2 );
$this->log(
array(
'source' => 'Unit price',
Expand All @@ -1439,7 +1439,7 @@ public function get_order_items( WC_Order $order, $only_not_settled = false ): a
}

$items[] = array(
'ordertext' => rp_clear_ordertext($order_item->get_name()),
'ordertext' => rp_clear_ordertext( $order_item->get_name() ),
'quantity' => $order_item->get_quantity(),
'amount' => rp_prepare_amount( $unit_price, $order->get_currency() ),
'vat' => round( $tax_percent / 100, 2 ),
Expand Down
2 changes: 1 addition & 1 deletion includes/OrderFlow/OrderCapture.php
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ public function get_item_data( WC_Order_Item $order_item, WC_Order $order ): arr
$unit_price = round( ( $prices_incl_tax ? $price['with_tax'] : $price['original'] ) / $order_item->get_quantity(), 2 );

return array(
'ordertext' => rp_clear_ordertext($order_item->get_name()),
'ordertext' => rp_clear_ordertext( $order_item->get_name() ),
'quantity' => $order_item->get_quantity(),
'amount' => rp_prepare_amount( $unit_price, $order->get_currency() ),
'vat' => round( $tax_percent / 100, 2 ),
Expand Down
6 changes: 3 additions & 3 deletions includes/Tokens/ReepayTokens.php
Original file line number Diff line number Diff line change
Expand Up @@ -217,11 +217,11 @@ public static function get_payment_token_by_order( WC_Order $order ) {
public static function get_payment_token_subscription( WC_Subscription $subscription ) {
$token = $subscription->get_meta( '_reepay_token' );
// If token wasn't stored in Subscription.
if ( !is_wp_error($token) && empty( $token ) ) {
if ( ! is_wp_error( $token ) && empty( $token ) ) {
$order = $subscription->get_parent();
if ( !is_wp_error($order) && $order ) {
if ( ! is_wp_error( $order ) && $order ) {
$token = $order->get_meta( '_reepay_token' );
if ( !is_wp_error($order) && empty( $token ) ) {
if ( ! is_wp_error( $order ) && empty( $token ) ) {
$invoice_data = reepay()->api( $order )->get_invoice_data( $order );
if ( ! empty( $invoice_data ) && ! is_wp_error( $invoice_data ) ) {
if ( ! empty( $invoice_data['recurring_payment_method'] ) ) {
Expand Down
4 changes: 2 additions & 2 deletions includes/Tokens/TokenReepay.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,13 @@ public function get_display_name( $deprecated = '' ): string {
}


public function delete($force_delete = false) {
public function delete( $force_delete = false ) {
global $wp;

if ( isset( $wp->query_vars['delete-payment-method'] ) ) {
$token_id = absint( $wp->query_vars['delete-payment-method'] );
$token = WC_Payment_Tokens::get( $token_id );
ReepayTokens::delete_card($token);
ReepayTokens::delete_card( $token );
}

parent::delete();
Expand Down
2 changes: 1 addition & 1 deletion templates/meta-boxes/invoice.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,4 +117,4 @@ class="reepay-admin-card-logo"/>
<?php _e( 'See invoice', 'reepay-subscriptions-for-woocommerce' ); ?>
</a>
</li>
</ul>
</ul>

0 comments on commit 8b5a61f

Please sign in to comment.