1: | <?php |
2: | |
3: | |
4: | |
5: | |
6: | |
7: | |
8: | |
9: | namespace Porta\Psr14Event\Example; |
10: | |
11: | use Porta\Psr14Event\Event; |
12: | use Porta\Psr14Event\EventHandlerBase; |
13: | |
14: | |
15: | |
16: | |
17: | |
18: | |
19: | |
20: | |
21: | |
22: | |
23: | |
24: | class BalanceChangeHandler extends EventHandlerBase |
25: | { |
26: | |
27: | protected function eventAccountBalanceChanged(Event $event): void |
28: | { |
29: | |
30: | error_log("Account # {$event['billing_entity_id']} balance changed " |
31: | . "from {$event['prev_balance']} to {$event['curr_balance']}"); |
32: | |
33: | |
34: | $event->onSuccess(); |
35: | } |
36: | |
37: | protected function eventCustomerBalanceChanged(Event $event): void |
38: | { |
39: | |
40: | error_log("Customer # $event->billing_entity_id balance changed " |
41: | . "from $event->prev_balance to $event->curr_balance"); |
42: | |
43: | |
44: | $event->onSuccess(); |
45: | } |
46: | } |
47: | |