Skip to content

Commit

Permalink
updated for phpcs configurations
Browse files Browse the repository at this point in the history
  • Loading branch information
BeycanDeveloper committed Mar 6, 2024
1 parent 0e0e14e commit eed6743
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 34 deletions.
46 changes: 23 additions & 23 deletions app/Gateways/AbstractGateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -212,16 +212,16 @@ public function setup_payment(): void
private function get_order_data(float $amount, Product $product): array
{
$transactionMetaDto = \Learndash_Transaction_Meta_DTO::create(
array(
[
Transaction::$meta_key_gateway_name => self::get_name(),
Transaction::$meta_key_price_type => LEARNDASH_PRICE_TYPE_PAYNOW,
Transaction::$meta_key_pricing_info => \Learndash_Pricing_DTO::create(
array(
[
'currency' => $this->currency_code,
'price' => number_format($amount / 100, 2, '.', ''),
)
]
),
)
]
);

$item = [
Expand All @@ -230,11 +230,11 @@ private function get_order_data(float $amount, Product $product): array
];

$metadata = array_merge(
array(
[
'is_learndash' => true,
'learndash_version' => LEARNDASH_VERSION,
'post_id' => $product->get_id(),
),
],
array_map(
function ($value) {
return is_array($value) ? wp_json_encode($value) : $value;
Expand All @@ -243,10 +243,10 @@ function ($value) {
)
);

return array(
return [
'item' => $item,
'metadata' => $metadata
);
];
}

/**
Expand Down Expand Up @@ -276,13 +276,13 @@ private function get_subscription_data(float $amount, \Learndash_Pricing_DTO $pr
$courseTrialPrice = $hasTrial ? $pricing->trial_price : 0.;

$transactionMetaDto = \Learndash_Transaction_Meta_DTO::create(
array(
[
Transaction::$meta_key_gateway_name => self::get_name(),
Transaction::$meta_key_price_type => LEARNDASH_PRICE_TYPE_SUBSCRIBE,
Transaction::$meta_key_pricing_info => $pricing,
Transaction::$meta_key_has_trial => $hasTrial,
Transaction::$meta_key_has_free_trial => $hasTrial && 0. === $courseTrialPrice,
)
]
);

$item = [
Expand All @@ -291,12 +291,12 @@ private function get_subscription_data(float $amount, \Learndash_Pricing_DTO $pr
];

$metadata = array_merge(
array(
[
'is_learndash' => true,
'learndash_version' => LEARNDASH_VERSION,
'post_id' => $product->get_id(),
'trial_period_days' => $trialDurationInDays > 0 ? $trialDurationInDays : null,
),
],
array_map(
function ($value) {
return is_array($value) ? wp_json_encode($value) : $value;
Expand All @@ -305,10 +305,10 @@ function ($value) {
)
);

return array(
return [
'item' => $item,
'metadata' => $metadata,
);
];
}

/**
Expand All @@ -322,12 +322,12 @@ private function map_trial_duration_in_days(int $durationValue, string $duration
return 0;
}

$durationNumberInDaysByLength = array(
$durationNumberInDaysByLength = [
'D' => 1,
'W' => 7,
'M' => 30,
'Y' => 365,
);
];

return $durationValue * $durationNumberInDaysByLength[$durationLength];
}
Expand Down Expand Up @@ -371,15 +371,15 @@ protected function map_transaction_meta(mixed $entity, Product $product): \Learn
$is_subscription = 'subscription' === $entity->mode;

$meta = array_merge(
$entity->metadata ? $entity->metadata->toArray() : array(),
array(
$entity->metadata ? $entity->metadata->toArray() : [],
[
Transaction::$meta_key_gateway_transaction => \Learndash_Transaction_Gateway_Transaction_DTO::create(
array(
[
'id' => $is_subscription ? $entity->subscription : $entity->payment_intent,
'event' => $entity,
)
]
),
)
]
);

$meta = $this->process_legacy_meta(
Expand All @@ -406,8 +406,8 @@ protected function map_transaction_meta(mixed $entity, Product $product): \Learn
*/
public function enqueue_scripts(): void
{
$deps = array_merge(array('jquery'), $this->get_deps());
wp_enqueue_style('ldlms-cp-style', LDLMS_CRYPTOPAY_URL . 'assets/css/main.css', array(), LDLMS_CRYPTOPAY_VERSION);
$deps = array_merge(['jquery'], $this->get_deps());
wp_enqueue_style('ldlms-cp-style', LDLMS_CRYPTOPAY_URL . 'assets/css/main.css', [], LDLMS_CRYPTOPAY_VERSION);
wp_enqueue_script('ldlms-cp-script', LDLMS_CRYPTOPAY_URL . 'assets/js/main.js', $deps, LDLMS_CRYPTOPAY_VERSION, true);

$ajaxUrl = admin_url('admin-ajax.php');
Expand Down
22 changes: 11 additions & 11 deletions app/Sections/AbstractSection.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,29 +97,29 @@ public function load_settings_values(): void
*/
public function load_settings_fields(): void
{
$this->setting_option_fields = array(
'enabled' => array(
$this->setting_option_fields = [
'enabled' => [
'name' => 'enabled',
'type' => 'checkbox-switch',
'label' => esc_html__('Active', 'ldlms-cryptopay'),
'value' => $this->setting_option_values['enabled'] ?? '',
'options' => array(
'options' => [
'yes' => '',
'' => '',
),
),
'theme' => array(
],
],
'theme' => [
'name' => 'theme',
'label' => esc_html__('Theme', 'ldlms-cryptopay'),
'type' => 'select',
'options' => array(
'options' => [
'light' => esc_html__('Light', 'ldlms-cryptopay'),
'dark' => esc_html__('Dark', 'ldlms-cryptopay'),
),
],
'default' => 'light',
'value' => $this->setting_option_values['theme'] ?? 'light',
),
);
],
];

$this->setting_option_fields = apply_filters(
'learndash_settings_fields',
Expand Down Expand Up @@ -154,7 +154,7 @@ public function filter_section_save_fields($value, $oldValue, $settingsSectionKe

if (isset($_POST['learndash_settings_payments_list_nonce'])) {
if (!is_array($oldValue)) {
$oldValue = array();
$oldValue = [];
}

foreach ($value as $valueIdx => $valueVal) {
Expand Down

0 comments on commit eed6743

Please sign in to comment.