From 94f726ad73268aca14d5704d57ae7daa3311acd1 Mon Sep 17 00:00:00 2001 From: Matthieu Rolland Date: Fri, 11 Oct 2024 16:19:34 +0200 Subject: [PATCH] add service and interface --- src/Core/Hook/HookModuleFilter.php | 46 ++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 src/Core/Hook/HookModuleFilter.php diff --git a/src/Core/Hook/HookModuleFilter.php b/src/Core/Hook/HookModuleFilter.php new file mode 100644 index 0000000000000..8d301f513e6e7 --- /dev/null +++ b/src/Core/Hook/HookModuleFilter.php @@ -0,0 +1,46 @@ + + * @copyright Since 2007 PrestaShop SA and Contributors + * @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) + */ + +namespace PrestaShop\PrestaShop\Core\Hook; + +class HookModuleFilter implements HookModuleFilterInterface +{ + private $hookModuleFilters; + + public function __construct(iterable $hookModuleFilters) + { + $this->hookModuleFilters = $hookModuleFilters; + } + + public function filterHookModuleExecList(array $modules, string $hookName): array + { + foreach ($this->hookModuleFilters as $hookModuleFilter) { + $modules = $hookModuleFilter->filterHookModuleExecList($modules, $hookName); + } + + return $modules; + } +}