public function with($hook)
    {
        if (!in_array($hook, PluginInterface::VALID_HOOKS)) {
            throw new InvalidArgumentException("The `{$hook}` hook is not a known plugin hook.");
        }
        foreach ($this as $plugin) {
            if ($plugin->isEnabled($hook)) {
                yield $plugin;
            }
        }
    }
public function with($hook)
    {
        if (!in_array($hook, PluginInterface::VALID_HOOKS)) {
            throw new InvalidArgumentException("The `{$hook}` hook is not a known plugin hook.");
        }
        foreach ($this as $plugin) {
            if ($plugin->isEnabled($hook)) {
                yield $plugin;
            }
        }
    }
public function with ( $ hook ) { if ( ! in_array ( $ hook , PluginInterface :: VALID_HOOKS ) ) { throw new InvalidArgumentException ( "The `{$hook}` hook is not a known plugin hook." ) ; } foreach ( $ this as $ plugin ) { if ( $ plugin -> isEnabled ( $ hook ) ) { yield $ plugin ; } } }
Filter the plugins to those with the named hook enabled.

@param string $hook The hook to filter plugins by
@return \Generator A generator containing matching plugins.
@throws \InvalidArgumentException on invalid hooks
Filter the plugins to those with the named hook enabled .