Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -199,38 +199,20 @@ protected function filterPluginsByResources(array $eventResourcePlugins, array $
protected function extractEffectivePlugins($effectivePlugins, $pluginsPerExporter): array
{
foreach ($effectivePlugins as $effectiveEventPlugins) {
$effectivePlugin = $this->findEffectivePlugin($effectiveEventPlugins);

if ($effectivePlugin === null) {
continue;
}

if ($this->isEventResourceRepositoryPlugin($effectivePlugin)) {
$pluginsPerExporter[static::REPOSITORY_EVENT_RESOURCE_PLUGINS][] = $effectivePlugin;
}

if ($this->isEventResourceQueryContainerPlugin($effectivePlugin)) {
$pluginsPerExporter[static::QUERY_CONTAINER_EVENT_RESOURCE_PLUGINS][] = $effectivePlugin;
foreach ($effectiveEventPlugins as $effectiveEventPlugin) {
if ($this->isEventResourceRepositoryPlugin($effectiveEventPlugin)) {
$pluginsPerExporter[static::REPOSITORY_EVENT_RESOURCE_PLUGINS][] = $effectiveEventPlugin;
}

if ($this->isEventResourceQueryContainerPlugin($effectiveEventPlugin)) {
$pluginsPerExporter[static::QUERY_CONTAINER_EVENT_RESOURCE_PLUGINS][] = $effectiveEventPlugin;
}
}
}

return $pluginsPerExporter;
}

/**
* @param array<\Spryker\Zed\EventBehavior\Dependency\Plugin\EventResourcePluginInterface> $eventResourcePlugins
*
* @return \Spryker\Zed\EventBehavior\Dependency\Plugin\EventResourcePluginInterface|null
*/
protected function findEffectivePlugin(array $eventResourcePlugins): ?EventResourcePluginInterface
{
if ($eventResourcePlugins === []) {
return null;
}

return current($eventResourcePlugins);
}

/**
* @param \Spryker\Zed\EventBehavior\Dependency\Plugin\EventResourcePluginInterface $eventResourcePlugin
*
Expand Down