public function attach(EventCollection $events) { $handles = array(); $handles[] = $events->attach('foo.bar', array($this, 'fooBar')); $handles[] = $events->attach('foo.baz', array($this, 'fooBaz')); $this->handles[\spl_object_hash($events)] = $handles; return __METHOD__; }
/** * Detach listeners * * @param Events $events * @return void */ public function detach(Events $events) { foreach ($this->listeners as $index => $listener) { if ($events->detach($listener)) { unset($this->listeners[$index]); } } }
public function detach(EventCollection $events) { foreach ($this->listeners as $key => $listener) { $events->detach($listener); unset($this->listeners[$key]); unset($listener); } }
public function attach(EventCollection $eventCollection) { $handles = array(); foreach ($this->eventCallbacks as $eventName => $method) { $handles[] = $eventCollection->attach($eventName, array($this, $method)); } $this->handles[\spl_object_hash($eventCollection)] = $handles; }
public function attach(EventCollection $events, $priority = null) { $this->priority = $priority; $listeners = array(); $listeners[] = $events->attach('foo.bar', array($this, 'fooBar')); $listeners[] = $events->attach('foo.baz', array($this, 'fooBaz')); $this->listeners[\spl_object_hash($events)] = $listeners; return __METHOD__; }
/** * Attach one or more listeners * * @param EventCollection $events * @return void */ public function attach(EventCollection $events) { $options = $this->getOptions(); $configListener = $this->getConfigListener(); $locatorRegistrationListener = new LocatorRegistrationListener($options); $moduleAutoloader = new ModuleAutoloader($options->getModulePaths()); $this->listeners[] = $events->attach('loadModules.pre', array($moduleAutoloader, 'register'), 1000); $this->listeners[] = $events->attach('loadModule.resolve', new ModuleResolverListener(), 1000); $this->listeners[] = $events->attach('loadModule', new AutoloaderListener($options), 2000); $this->listeners[] = $events->attach('loadModule', new InitTrigger($options), 1000); $this->listeners[] = $events->attachAggregate($locatorRegistrationListener); $this->listeners[] = $events->attachAggregate($configListener); return $this; }
public function attach(EventCollection $events) { $events->attach('foo.bar', array($this, 'fooBar')); $events->attach('foo.baz', array($this, 'fooBaz')); }