Exemplo n.º 1
0
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') . ']');
    }
}
Exemplo n.º 2
0
 /**
  * @return boolean
  * @param string|\Nano\Event $eventOrType
  */
 public function callbackExists($eventOrType)
 {
     return $this->callbacks->offsetExists($eventOrType instanceof \Nano\Event ? $eventOrType->getType() : $eventOrType);
 }
Exemplo n.º 3
0
 protected function checkHandlerCalled(\Nano\Event $event)
 {
     self::assertEquals(0, $event->getArgument('runs', 0));
     $this->manager->trigger($event);
     self::assertEquals(1, $event->getArgument('runs', 0));
 }
Exemplo n.º 4
0
 public function testGettingUndefinedArguments()
 {
     $event = \Nano\Event::create('foo');
     self::assertNull($event->getArgument('foo'));
     self::assertEquals('bar', $event->getArgument('baz', 'bar'));
 }