Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am pavarnos on github.
  • I am pavarnos (https://keybase.io/pavarnos) on keybase.
  • I have a public key ASB0cfRH3eeygOa3EIVPp8UE_hcpCPUAsYb-tp-M58s2bAo

To claim this, I am signing this object:

<?php
use ISV\Service\Cache\CacheInterface;
use ISV\Service\Cache\FileCache;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\EventDispatcher\Event;
use Symfony\Component\EventDispatcher\EventDispatcher;
/**
* Overrides the symfony event dispatcher so that we don't call addListener() 400 times for every request when 90%
* of requests never dispatch an event.
<?php
/**
* Add this to your container builder with
* $containerBuilder->addCompilerPass(new ConfigureLazyEventDispatcher(new LazyEventDispatcher($containerBuilder));
*/
class ConfigureLazyEventDispatcher implements CompilerPassInterface
{
/** @var LazyEventDispatcher */
private $dispatcher;