Skip to content

Commit

Permalink
cs fix
Browse files Browse the repository at this point in the history
  • Loading branch information
fmido88 authored Feb 17, 2024
1 parent 29be817 commit b86e1d1
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 24 deletions.
3 changes: 2 additions & 1 deletion classes/category/options.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,13 @@ public function get_parents_options() {
* @return array[string]
*/
public static function get_all_categories_options() {
$catoptions = [0 => get_string('any')];
$catoptions = [];
$allcats = \core_course_category::get_all();
foreach ($allcats as $catid => $cat) {
$catoptions[$catid] = $cat->get_nested_name(false);
}
asort($catoptions, SORT_STRING | SORT_FLAG_CASE);
$catoptions = [0 => get_string('any')] + $catoptions;
return $catoptions;
}

Expand Down
2 changes: 1 addition & 1 deletion classes/privacy/provider.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class provider implements
* @param collection $collection The initialized collection to add items to.
* @return collection A listing of user data stored through this system.
*/
public static function get_metadata(collection $collection) :collection {
public static function get_metadata(collection $collection): collection {
$collection->add_database_table('enrol_wallet_items', [
'userid' => "privacy:metadata:enrol_wallet_items:userid",
'cost' => "privacy:metadata:enrol_wallet_items:cost",
Expand Down
2 changes: 1 addition & 1 deletion classes/util/balance.php
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ protected function set_main_balance() {
* from the transaction table.
* @return float
*/
private function get_nonrefund_from_transactions():float {
private function get_nonrefund_from_transactions(): float {
global $DB;
$balance = $this->get_main_balance();
$record = $DB->get_records('enrol_wallet_transactions', ['userid' => $this->userid], 'id DESC', 'norefund', 0, 1);
Expand Down
2 changes: 1 addition & 1 deletion classes/util/cm.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public function __construct($cmid, $userid = 0) {
* Set all available costs for this cm, considering multiple conditions may be applied.
* @param \stdClass $conditions the availability tree.
*/
private function set_costs ($conditions) {
private function set_costs($conditions) {
foreach ($conditions->c as $child) {
if (!empty($child->c) && !empty($child->op)) {
$this->set_costs($child);
Expand Down
2 changes: 1 addition & 1 deletion styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@
font-size: 0.8em;
}
}

.enrol_wallet_topup .accordion .accordion__title {
display: block;
font-size: 1.1rem;
Expand Down
22 changes: 11 additions & 11 deletions tests/coupons_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class coupons_test extends \advanced_testcase {
* Test if a certain type of coupons are enabled
* @covers ::is_enabled_type
*/
public function test_is_enabled_type():void {
public function test_is_enabled_type(): void {
$this->setUser($this->u2);
$coupons = new coupons('fixed1');
$this->assertFalse($coupons->is_enabled_type());
Expand Down Expand Up @@ -119,7 +119,7 @@ public function test_is_enabled_type():void {
* Test if coupons are enabled in this site.
* @covers ::is_enabled()
*/
public function test_is_enabled():void {
public function test_is_enabled(): void {
$this->assertFalse(coupons::is_enabled());
$this->set_config(coupons::DISCOUNT);
$this->assertTrue(coupons::is_enabled());
Expand All @@ -138,7 +138,7 @@ public function test_is_enabled():void {
* Test validation for fixed coupons
* @covers ::validate_coupon()
*/
public function test_validate_fixed_coupon():void {
public function test_validate_fixed_coupon(): void {
$this->set_config(coupons::ALL);
// Not logged in.
$coupons = new coupons('fixed1');
Expand Down Expand Up @@ -212,7 +212,7 @@ public function test_validate_fixed_coupon():void {
* Test validation for enrol coupons
* @covers ::validate_coupon
*/
public function test_validate_enrol_coupon():void {
public function test_validate_enrol_coupon(): void {
$this->setUser($this->u1);
$this->set_config([coupons::ENROL]);
$coupons = new coupons('enrol1');
Expand Down Expand Up @@ -329,7 +329,7 @@ public function test_validate_enrol_coupon():void {
* Validation for discount coupons.
* @covers ::validate_coupon()
*/
public function test_validate_discount_coupon():void {
public function test_validate_discount_coupon(): void {
$this->set_config(coupons::DISCOUNT);
$coupons = new coupons('percent1');
$this->assertNotTrue($coupons->validate_coupon(coupons::AREA_ENROL, $this->inst1->id));
Expand Down Expand Up @@ -437,7 +437,7 @@ public function test_validate_discount_coupon():void {
* Validate category coupons
* @covers ::validate_coupons()
*/
public function test_validate_category_coupon():void {
public function test_validate_category_coupon(): void {
$this->set_config(coupons::CATEGORY);
// Not logged in.
$coupons = new coupons('category1');
Expand Down Expand Up @@ -506,7 +506,7 @@ public function test_validate_category_coupon():void {
* Test applying fixed coupon
* @covers ::apply_coupon()
*/
public function test_apply_fixed_coupon():void {
public function test_apply_fixed_coupon(): void {
$this->set_config(coupons::FIXED);
$coupons = new coupons('fixed1', $this->u1->id);
$coupons->apply_coupon();
Expand Down Expand Up @@ -576,7 +576,7 @@ public function test_apply_fixed_coupon():void {
* Test applying category coupon
* @covers ::apply_coupon()
*/
public function test_apply_category_coupon():void {
public function test_apply_category_coupon(): void {
$this->set_config(coupons::CATEGORY);

$this->setUser($this->u1);
Expand Down Expand Up @@ -616,7 +616,7 @@ public function test_apply_category_coupon():void {
* Test applying enrol coupons
* @covers ::apply_coupon
*/
public function test_apply_enrol_coupon():void {
public function test_apply_enrol_coupon(): void {
$this->set_config(coupons::ENROL);
$this->setUser($this->u1);
$coupons = new coupons('enrol1');
Expand Down Expand Up @@ -647,7 +647,7 @@ public function test_apply_enrol_coupon():void {
* Generate a number of coupons of different data, types and restrictions
* to be tested.
*/
protected function setUp() :void {
protected function setUp(): void {
parent::setUp();
global $DB, $CFG;
require_once($CFG->dirroot."/enrol/wallet/locallib.php");
Expand Down Expand Up @@ -945,7 +945,7 @@ protected function setUp() :void {
* We will use this frequently, so we can shorten the arguments.
* @param int|array $value
*/
private function set_config($value) {
private function set_config($value): void {
if (is_array($value)) {
$value = implode(',', $value);
}
Expand Down
14 changes: 7 additions & 7 deletions tests/util/balance_op_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ public function test_conditional_discount_charging(): void {
* @covers ::credit
* @return void
*/
public function test_credit():void {
public function test_credit(): void {
global $DB;
$this->resetAfterTest();
$gen = $this->getDataGenerator();
Expand Down Expand Up @@ -377,7 +377,7 @@ public function test_credit():void {
* @covers ::credit
* @return void
*/
public function test_credit_nocat():void {
public function test_credit_nocat(): void {
global $DB;
$this->resetAfterTest();
$gen = $this->getDataGenerator();
Expand Down Expand Up @@ -506,7 +506,7 @@ public function test_credit_nocat():void {
* @covers ::debit
* @return void
*/
public function test_debit():void {
public function test_debit(): void {
global $DB;
$this->resetAfterTest();
$gen = $this->getDataGenerator();
Expand Down Expand Up @@ -640,7 +640,7 @@ public function test_debit():void {
* @covers ::debit
* @return void
*/
public function test_debit_nocat():void {
public function test_debit_nocat(): void {
global $DB;
$this->resetAfterTest();
set_config('catbalance', 0, 'enrol_wallet');
Expand Down Expand Up @@ -802,7 +802,7 @@ public function test_debit_nocat():void {
* @covers ::get_total_free
* @return void
*/
public function test_free_balance():void {
public function test_free_balance(): void {
global $DB;
$this->resetAfterTest();
$gen = $this->getDataGenerator();
Expand Down Expand Up @@ -940,7 +940,7 @@ public function test_free_balance():void {
* Test transferring balance to another user.
* @covers ::transfer_to_other()
*/
public function test_transfer_to_other():void {
public function test_transfer_to_other(): void {
$this->resetAfterTest();
$gen = $this->getDataGenerator();
$user1 = $gen->create_user();
Expand Down Expand Up @@ -1029,7 +1029,7 @@ public function test_transfer_to_other():void {
* Used to reset the balance of a user to zero.
* @param int $userid
*/
private function reset_balance($userid):void {
private function reset_balance($userid): void {
$op = new balance_op($userid);
$op->debit($op->get_valid_balance(), $op::OTHER);
$details = $op->get_balance_details();
Expand Down
2 changes: 1 addition & 1 deletion tests/util/instance_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ public function test_get_cost_after_discount(): void {
* Testing discounts after first and second repurchase
* @covers ::get_cost_after_discount
*/
public function test_repurchase_discount_and_function():void {
public function test_repurchase_discount_and_function(): void {
global $DB;
$this->resetAfterTest();
$wallet = new enrol_wallet_plugin;
Expand Down

0 comments on commit b86e1d1

Please sign in to comment.