| 1 |
<?php |
| 2 |
|
| 3 |
namespace SimpleAnalytics; |
| 4 |
|
| 5 |
trait PluginLifecycle |
| 6 |
{ |
| 7 |
public function boot(): void |
| 8 |
{ |
| 9 |
$this->onBoot(); |
| 10 |
add_action('init', \Closure::fromCallable([$this, 'onInit'])); |
| 11 |
register_activation_hook(ENTRYPOINT_FILE, \Closure::fromCallable([$this, 'onActivation'])); |
| 12 |
register_deactivation_hook(ENTRYPOINT_FILE, \Closure::fromCallable([$this, 'onUninstall'])); |
| 13 |
} |
| 14 |
|
| 15 |
/** @internal */ |
| 16 |
abstract protected function onBoot(): void; |
| 17 |
|
| 18 |
/** @internal */ |
| 19 |
abstract public function onInit(): void; |
| 20 |
|
| 21 |
/** @internal */ |
| 22 |
abstract public function onActivation(): void; |
| 23 |
|
| 24 |
/** @internal */ |
| 25 |
abstract public function onUninstall(): void; |
| 26 |
} |
| 27 |
|