compucorp / uk.co.compucorp.membershipextras

Membership Extras for CiviCRM
Other
5 stars 8 forks source link

MAE-635: Reorganize part of the folder structure #416

Closed omarabuhussein closed 2 years ago

omarabuhussein commented 2 years ago

Overview

While looking through Membershipextras folder structure I found some classes that have no need to be in their own folders, these classes are:

1- CRM_MembershipExtras_PaymentProcessorType_ManualRecurringPayment: Contains extension installation, uninstallation, enabling and disabling logic for the Manual payment processor type, it exist inside a folder called PaymentProcessorType .

2- CRM_MembershipExtras_PaymentProcessor_OfflineRecurringContribution: Contains extension installation, uninstallation, enabling and disabling logic for the Manual payment processor, it exist inside a folder called PaymentProcessor.

3- We had a folder called Utils and another called Helper, and there is no really a difference between both since both contain helper classes.

So to improve the current structure a bit, I :

1- Moved both CRM_MembershipExtras_PaymentProcessorType_ManualRecurringPayment and CRM_MembershipExtras_PaymentProcessor_OfflineRecurringContribution classes to the Upgrader.php file where all of our extension installation, uninstallation, disabling and enabling logic resides, and thus I removed both PaymentProcessorType and PaymentProcessor folders since they only contained these classes.

2- Moved the only class that exist into the Utils folder into the Helper folder.

Problems

Now there are problems with the stuff I did here which are:

1- Doesn't moving the code to Upgrader.php make the class longer, more complex and messy?

2- Aren't Utils and Helper classes are bad?

Well, that is debated, but certainly having a bunch of classes that have nothing to do with each other in one folder just because they are "Helpers" is not a good idea, though the idea here is just to have one of these folders (I moved the Utils folder classes into the Utils folder) instead of having two (Utils and Helper) and then in another ticket I will try to see if there is a better way to organize the classes in the Helper folder.