| Total Complexity | 5 |
| Total Lines | 37 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 7 | class BroadcastEvent implements EventBroadcaster |
||
| 8 | { |
||
| 9 | private Analytics $analytics; |
||
| 10 | |||
| 11 | public function __construct(Analytics $analytics) |
||
| 12 | { |
||
| 13 | $this->analytics = $analytics; |
||
| 14 | } |
||
| 15 | |||
| 16 | /** |
||
| 17 | * Call the callback with the Analytics instance. |
||
| 18 | */ |
||
| 19 | public function withAnalytics(callable $callback): self |
||
| 24 | } |
||
| 25 | |||
| 26 | /** |
||
| 27 | * Sets the name of the EventAction, calls the 'withAnalytics' method |
||
| 28 | * on the events if it exists and then sends the event |
||
| 29 | * to Google Analytics. |
||
| 30 | */ |
||
| 31 | public function handle($event): void |
||
| 44 | } |
||
| 45 | } |
||
| 46 |