function library_events_handler_common(\Nano\Event $event) { $runs = $event->getArgument('runs', 0); ++$runs; $event->setArgument('runs', $runs); if ($event->getArgument('text')) { $event->setArgument('text', '[' . $event->getArgument('text') . ']'); } }
/** * @return boolean * @param string|\Nano\Event $eventOrType */ public function callbackExists($eventOrType) { return $this->callbacks->offsetExists($eventOrType instanceof \Nano\Event ? $eventOrType->getType() : $eventOrType); }
protected function checkHandlerCalled(\Nano\Event $event) { self::assertEquals(0, $event->getArgument('runs', 0)); $this->manager->trigger($event); self::assertEquals(1, $event->getArgument('runs', 0)); }
public function testGettingUndefinedArguments() { $event = \Nano\Event::create('foo'); self::assertNull($event->getArgument('foo')); self::assertEquals('bar', $event->getArgument('baz', 'bar')); }