Skip to content

Commit

Permalink
fix PHP-CS-Fixer detected errors
Browse files Browse the repository at this point in the history
  • Loading branch information
juan-cortizas-ponte committed Dec 29, 2022
1 parent 26847cf commit fb52305
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 39 deletions.
2 changes: 1 addition & 1 deletion plugin/buycourses/lang/english.php
Expand Up @@ -309,4 +309,4 @@
$strings['SelecSubscription'] = "Select a subscription";
$strings['ConfigureSubscriptionsFrequencies'] = "Configure subscriptions periods";
$strings['FrequencyAdd'] = "Add Frequency";
$strings['SubscriptionAlreadyExists'] = "Subscription already exists";
$strings['SubscriptionAlreadyExists'] = "Subscription already exists";
2 changes: 1 addition & 1 deletion plugin/buycourses/lang/spanish.php
Expand Up @@ -314,4 +314,4 @@
$strings['SelecSubscription'] = "Seleccione una suscripción";
$strings['ConfigureSubscriptionsFrequencies'] = "Configurar los períodos de suscripciones";
$strings['FrequencyAdd'] = "Agregar período";
$strings['SubscriptionAlreadyExists'] = "La suscripción ya existe";
$strings['SubscriptionAlreadyExists'] = "La suscripción ya existe";
51 changes: 26 additions & 25 deletions plugin/buycourses/src/buy_course_plugin.class.php
Expand Up @@ -947,7 +947,7 @@ public function getSubscriptionItem(int $itemId, int $productType)
*
* @return array
*/
public function getSubscriptionItemByProduct(int $productId, int $itemType, $coupon =null)
public function getSubscriptionItemByProduct(int $productId, int $itemType, $coupon = null)
{
$buySubscriptionItemTable = Database::get_main_table(self::TABLE_SUBSCRIPTION);
$buyCurrencyTable = Database::get_main_table(self::TABLE_CURRENCY);
Expand Down Expand Up @@ -980,6 +980,7 @@ public function getSubscriptionItemByProduct(int $productId, int $itemType, $cou

return $item;
}

/**
* Get the item data.
*
Expand Down Expand Up @@ -1024,7 +1025,7 @@ public function getSubscriptionsItemsByProduct(int $productId, int $itemType)
}

/**
* Get registered item data.by duration
* Get registered item data.by duration.
*
* @param int $duration The subscription duration
*
Expand All @@ -1037,7 +1038,7 @@ public function getSubscriptiosnItemsByDuration(int $duration)
Database::get_main_table(self::TABLE_SUBSCRIPTION),
[
'where' => ['duration = ?' => [
$duration],
$duration, ],
],
]
);
Expand Down Expand Up @@ -1195,8 +1196,8 @@ public function getCatalogCourseList($first, $pageSize, $name = null, $min = 0,
*
* @param int $start
* @param int $end
* @param string $name Optional. The name filter.
* @param string $typeResult Optional. 'all', 'first' or 'count'.
* @param string $name Optional. The name filter.
* @param string $typeResult Optional. 'all', 'first' or 'count'.
* @param int $sessionCategory Optional. Session category id
*
* @return array|int
Expand Down Expand Up @@ -4300,7 +4301,7 @@ public function registerSubscriptionSale($productId, $productType, $paymentType,
$price = $priceWithoutTax + $taxAmount;
}

$subscriptionEnd = Date('y:m:d', strtotime('+'. $duration .' days'));
$subscriptionEnd = date('y:m:d', strtotime('+'.$duration.' days'));

$values = [
'reference' => $this->generateReference(
Expand Down Expand Up @@ -4339,7 +4340,7 @@ public function addNewSubscription($subscription)
{
$result = false;

if(isset($subscription['frequencies'])) {
if (isset($subscription['frequencies'])) {
foreach ($subscription['frequencies'] as $frequency) {
$subscriptionDb = $this->getSubscription($subscription['product_type'], $subscription['product_id'], $frequency['duration']);

Expand Down Expand Up @@ -4379,10 +4380,10 @@ public function addNewSubscription($subscription)
)
);

return false ;
return false;
}

return $result ;
return $result;
}

/**
Expand Down Expand Up @@ -4421,8 +4422,8 @@ public function deleteSubscription($productType, $productId, $duration)
/**
* Get a list of subscriptions by product ID and type.
*
* @param string $productId The product ID
* @param int $productType The product type
* @param string $productId The product ID
* @param int $productType The product type
*
* @return array Subscriptions data
*/
Expand All @@ -4436,9 +4437,9 @@ public function getSubscriptions($productType, $productId)
/**
* Get data of the subscription.
*
* @param string $productId The product ID
* @param int $productType The product type
* @param int $duration The duration
* @param string $productId The product ID
* @param int $productType The product type
* @param int $duration The duration
*
* @return array The subscription data
*/
Expand Down Expand Up @@ -4528,7 +4529,7 @@ public function cancelSubscriptionSale($saleId)
$this->updateSubscriptionSaleStatus($saleId, self::SALE_STATUS_CANCELED);
}

/**
/**
* Get a list of subscription sales by the status.
*
* @param int $status The status to filter
Expand Down Expand Up @@ -4812,7 +4813,7 @@ public function getSubscriptionsDue($date)
$date,
self::SALE_STATUS_COMPLETED,
1,
]
],
],
],
'first'
Expand Down Expand Up @@ -4840,7 +4841,7 @@ public function checkItemSubscriptionActive($userId, $productId, $productType)
$productId,
$productType,
self::SALE_STATUS_COMPLETED,
]
],
],
],
'first'
Expand Down Expand Up @@ -4879,9 +4880,9 @@ public function getFrequencies()
);

$frequenciesList = $this->getFrequenciesList();
$frequencies = array();
$frequencies = [];

foreach($data as $key => $items) {
foreach ($data as $key => $items) {
$frequencies[$items['duration']] = $items['name'];
}

Expand Down Expand Up @@ -6043,8 +6044,8 @@ private function deleteCouponServicesByCoupon($couponId)
/**
* Get an array of subscriptions.
*
* @param int $productType The product type
* @param int $productId The product ID
* @param int $productType The product type
* @param int $productId The product ID
*
* @return array Subscriptions data
*/
Expand All @@ -6068,9 +6069,9 @@ private function getDataSubscriptions($productType, $productId)
/**
* Get data of a subscription for a product (course or service) by the subscription ID.
*
* @param int $productType The product type
* @param int $productId The product ID
* @param int $duration The duration
* @param int $productType The product type
* @param int $productId The product ID
* @param int $duration The duration
*
* @return array The subscription data
*/
Expand Down Expand Up @@ -6110,7 +6111,7 @@ private function updateSubscription($productType, $productId, $taxPerc)
$values,
[
'product_type = ? AND ' => $productType,
'product_id = ?' => $productId
'product_id = ?' => $productId,
]
);

Expand Down
7 changes: 2 additions & 5 deletions plugin/buycourses/src/configure_frequency.php
Expand Up @@ -16,7 +16,6 @@

if (isset($_GET['action'], $_GET['d'], $_GET['n'])) {
if ($_GET['action'] == 'delete_frequency') {

if (is_numeric($_GET['d'])) {
$frequency = $plugin->selectFrequency($_GET['d']);

Expand All @@ -34,14 +33,12 @@
Display::return_message($plugin->get_lang('SubscriptionPeriodOnUse'), 'error')
);
}
}
else {
} else {
Display::addFlash(
Display::return_message($plugin->get_lang('FrequencyNotExits'), 'error')
);
}
}
else {
} else {
Display::addFlash(
Display::return_message($plugin->get_lang('FrequencyIncorrect'), 'error')
);
Expand Down
8 changes: 4 additions & 4 deletions plugin/buycourses/src/configure_subscription.php
Expand Up @@ -51,11 +51,11 @@
);
}

$subscriptions = $plugin->getSubscriptions($type, $id );
$subscriptions = $plugin->getSubscriptions($type, $id);

$taxtPerc = 0;

if (isset($subscriptions) && !empty($subscriptions )) {
if (isset($subscriptions) && !empty($subscriptions)) {
$taxtPerc = $subscriptions[0]['tax_perc'];
}

Expand All @@ -78,7 +78,7 @@
'visible' => $courseItem['visible'],
'tax_perc' => $taxtPerc,
];
} else if ($editingSession) {
} elseif ($editingSession) {
if (!$includeSession) {
api_not_allowed(true);
}
Expand Down Expand Up @@ -180,7 +180,7 @@
false,
[
'step' => 1,
'cols-size' => [3, 8, 1]
'cols-size' => [3, 8, 1],
]
);

Expand Down
2 changes: 1 addition & 1 deletion plugin/buycourses/src/subscription_add.php
Expand Up @@ -59,7 +59,7 @@
'tax_perc' => $courseItem['tax_perc'],
'currency_id' => $currency['id'],
];
} else if ($editingSession) {
} elseif ($editingSession) {
if (!$includeSession) {
api_not_allowed(true);
}
Expand Down
4 changes: 2 additions & 2 deletions plugin/buycourses/src/subscription_process.php
Expand Up @@ -177,9 +177,9 @@
$frequencies = $plugin->getFrequencies();
$selectedFrequencies = [];

foreach($subscriptionItems as $si) {
foreach ($subscriptionItems as $si) {
if (isset($frequencies[$si['duration']])) {
$selectedFrequencies[$si['duration']] = $frequencies[$si['duration']].' - '.$si['price_formatted'] . ' ' . $si['iso_code'];
$selectedFrequencies[$si['duration']] = $frequencies[$si['duration']].' - '.$si['price_formatted'].' '.$si['iso_code'];
}
}

Expand Down

0 comments on commit fb52305

Please sign in to comment.