Seminars
Seminars code required refactoring as it is became hard to maintain it in current state. For example, there were practically no classes, lib.php had around 140 functions with inconsistent and overlapping functionality and typical change of attendees management file required around 20 changes in different parts of file. Some capabilities had different meaning during activity editing callback and attendees list management (as well as behaviour itself in this two scenarios could be different).
Goals
Reduce complexity of code
Make all logic testable in phpunit
Reorganise code according coding standard, make it readable and maintainable
Make naming of code more consistent with Seminars, not Facetoface
Prepare code for make it RESTful compatible
Allow faster and more reliable development of new functionality
Consistency in booking states and their transitions
Scope
Scope of refactoring was divided on the following areas:
Booking statuses
Seminar management
Attendees management
Notifications change API to use OOP only
Multi-language filter support for notifications
Enrol plugin
Code organisation - creating OOP structure that represents Seminars and their functionality
As result of refactoring the following changes should occur:
No logic in entry point files are used (except generic one).
All functions except callbacks in lib.php are deprecated and not used by core code
All Activities, Events, Bookings and Notifications logic is encapsulated in autoloaded classes
Logic that previously was not possible to test in phpunit because it was in entry point php files is covered by tests