forked from StartupAPI/users
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSubscriptionModule.php
More file actions
29 lines (23 loc) · 810 Bytes
/
SubscriptionModule.php
File metadata and controls
29 lines (23 loc) · 810 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<?php
interface ISubscriptionModule extends IUserBaseModule
{
/**
* This function should be called when new user is created
*/
public function registerStartTariff($user);
/**
* This function should be called when user information has changed
* e.g. email address or additional information passed to provider like name or gender and etc.
*/
public function updateTariff($old_user, $new_user);
}
abstract class SubscriptionModule extends UserBaseModule implements ISubscriptionModule {
public function __construct() {
parent::__construct();
if (!is_null(UserConfig::$subscription_module)) {
throw new SubscriptionModuleException("You can assign only one subscription module");
}
UserConfig::$subscription_module = $this;
}
}
class SubscriptionModuleException extends Exception {}