| @@ -6,9 +6,8 @@ | ||
| 6 | 6 | * Central registry for all plugin license info objects. |
| 7 | 7 | * |
| 8 | 8 | * Plugins call register() during 'yaycommerce_admin_shell_booted' action. |
| 9 | 9 | * The Licenses page calls all() to render the unified list. |
| 10 | - * @internal | |
| 11 | 10 | */ |
| 12 | 11 | class LicenseRegistry |
| 13 | 12 | { |
| 14 | 13 | /** @var PluginLicenseInfo[] keyed by slug */ |
| @@ -15,12 +14,12 @@ | ||
| 15 | 14 | private array $plugins = []; |
| 16 | 15 | /** |
| 17 | 16 | * Register a plugin's license info. Applies the decoration filter before storing. |
| 18 | 17 | */ |
| 19 | - public function register($info) : void | |
| 18 | + public function register($info): void | |
| 20 | 19 | { |
| 21 | 20 | /** @var PluginLicenseInfo $info */ |
| 22 | - $info = \apply_filters('yaycommerce_admin_shell_plugin_info', $info, $info->slug); | |
| 21 | + $info = apply_filters('yaycommerce_admin_shell_plugin_info', $info, $info->slug); | |
| 23 | 22 | $this->plugins[$info->slug] = $info; |
| 24 | 23 | } |
| 25 | 24 | /** |
| 26 | 25 | * Return all registered PluginLicenseInfo objects, keyed by slug. |
| @@ -26,27 +25,27 @@ | ||
| 26 | 25 | * Return all registered PluginLicenseInfo objects, keyed by slug. |
| 27 | 26 | * |
| 28 | 27 | * @return PluginLicenseInfo[] |
| 29 | 28 | */ |
| 30 | - public function all() : array | |
| 29 | + public function all(): array | |
| 31 | 30 | { |
| 32 | 31 | // Refactor old licensing plugin integration |
| 33 | 32 | $old_plugins = []; |
| 34 | - $handlers = ['YayMailScoped\\YAYDP\\License\\License_Handler', 'YayMailScoped\\YayMail\\License\\LicenseHandler', 'YayMailScoped\\Yay_Currency\\License\\LicenseHandler', 'YayMailScoped\\Yay_Swatches\\License\\LicenseHandler', 'YayMailScoped\\YayExtra\\License\\LicenseHandler', 'YayMailScoped\\YayRev\\License\\LicenseHandler', 'YayMailScoped\\YayWholesaleB2B\\License\\LicenseHandler', 'YayMailScoped\\YaySMTP\\License\\LicenseHandler']; | |
| 33 | + $handlers = ['YayMailScoped\YAYDP\License\License_Handler', 'YayMailScoped\YayMail\License\LicenseHandler', 'YayMailScoped\Yay_Currency\License\LicenseHandler', 'YayMailScoped\Yay_Swatches\License\LicenseHandler', 'YayMailScoped\YayExtra\License\LicenseHandler', 'YayMailScoped\YayRev\License\LicenseHandler', 'YayMailScoped\YayWholesaleB2B\License\LicenseHandler', 'YayMailScoped\YaySMTP\License\LicenseHandler']; | |
| 35 | 34 | foreach ($handlers as $handler) { |
| 36 | - if (\class_exists($handler) && \method_exists($handler, 'get_licensing_plugins')) { | |
| 35 | + if (class_exists($handler) && method_exists($handler, 'get_licensing_plugins')) { | |
| 37 | 36 | $plugins = $handler::get_licensing_plugins(); |
| 38 | - if (\is_array($plugins)) { | |
| 39 | - $old_plugins = \array_merge($old_plugins, $plugins); | |
| 37 | + if (is_array($plugins)) { | |
| 38 | + $old_plugins = array_merge($old_plugins, $plugins); | |
| 40 | 39 | } |
| 41 | 40 | } |
| 42 | 41 | } |
| 43 | - return \array_merge($this->plugins, $old_plugins); | |
| 42 | + return array_merge($this->plugins, $old_plugins); | |
| 44 | 43 | } |
| 45 | 44 | /** |
| 46 | 45 | * Return a single PluginLicenseInfo by slug, or null if not registered. |
| 47 | 46 | */ |
| 48 | - public function get(string $slug) : ?PluginLicenseInfo | |
| 47 | + public function get(string $slug): ?PluginLicenseInfo | |
| 49 | 48 | { |
| 50 | 49 | return $this->plugins[$slug] ?? null; |
| 51 | 50 | } |
| 52 | 51 | /** |
| @@ -51,9 +50,9 @@ | ||
| 51 | 50 | } |
| 52 | 51 | /** |
| 53 | 52 | * Check if a slug is registered. |
| 54 | 53 | */ |
| 55 | - public function has(string $slug) : bool | |
| 54 | + public function has(string $slug): bool | |
| 56 | 55 | { |
| 57 | 56 | return isset($this->plugins[$slug]); |
| 58 | 57 | } |
| 59 | 58 | } |