From 5b64e13e6dd9106dbaa49c585955ea68f99675f6 Mon Sep 17 00:00:00 2001 From: Bart Jaskulski <bjaskulski@protonmail.com> Date: Tue, 25 Apr 2023 11:59:10 +0200 Subject: [PATCH] refactor: hookable driver should belong to separate package Signed-off-by: Bart Jaskulski <bjaskulski@protonmail.com> --- src/HookDriver/HookableBundle.php | 10 ---------- src/HookDriver/HookableDriver.php | 23 ----------------------- 2 files changed, 33 deletions(-) delete mode 100644 src/HookDriver/HookableBundle.php delete mode 100644 src/HookDriver/HookableDriver.php diff --git a/src/HookDriver/HookableBundle.php b/src/HookDriver/HookableBundle.php deleted file mode 100644 index 7787f67..0000000 --- a/src/HookDriver/HookableBundle.php +++ /dev/null @@ -1,10 +0,0 @@ -<?php -declare( strict_types=1 ); - -namespace WPDesk\Init\HookDriver; - -interface HookableBundle extends \WPDesk\Init\Bundle\Bundle { - - public static function hookable(): array; - -} \ No newline at end of file diff --git a/src/HookDriver/HookableDriver.php b/src/HookDriver/HookableDriver.php deleted file mode 100644 index 6849ca5..0000000 --- a/src/HookDriver/HookableDriver.php +++ /dev/null @@ -1,23 +0,0 @@ -<?php -declare( strict_types=1 ); - -namespace WPDesk\Init\HookDriver; - -use Psr\Container\ContainerInterface; -use WPDesk\Init\Configuration\ReadableConfig; - -class HookableDriver implements HookDriver { - - public function register_hooks( ReadableConfig $config, array $bundles, ContainerInterface $container ): void { - $subscribers = $config->get( 'hookables', [] ); - - foreach ( $bundles as $bundle ) { - $subscribers = \array_merge( $subscribers, $bundle::hookable() ); - } - - foreach ( $subscribers as $subscriber ) { - $container->get( $subscriber )->hooks(); - } - } - -} \ No newline at end of file -- GitLab