Beispiel #1
0
 public static function receiveException(Event\Bucket $bucket)
 {
     // Early draft.
     self::$_message = $bucket->getData()->raise();
     return;
 }
Beispiel #2
0
 /**
  * onQuery callback
  *
  * @param \Hoa\Event\Bucket $bucket
  * @return false|string
  */
 function onQueryCallback(\Hoa\Event\Bucket $bucket)
 {
     $data = $bucket->getData();
     return $this->resolve($data['type'], $this->stripTld($data['domain']));
 }
Beispiel #3
0
 public function case_set_data()
 {
     $this->given($bucket = new SUT(), $datumA = 'foo')->when($result = $bucket->setData($datumA))->then->variable($result)->isNull()->string($bucket->getData())->isEqualTo($datumA)->given($datumB = 'bar')->when($result = $bucket->setData($datumB))->then->string($result)->isEqualTo($datumA)->string($bucket->getData())->isEqualTo($datumB);
 }
Beispiel #4
0
 /**
  * Fire an event
  *
  * @param string                $event
  * @param Hoa\Event\Bucket $bucket
  * @param mixed                 $additionnalData
  * @param boolean               $log
  *
  * @return void
  */
 public function onEvent($event, Bucket $bucket, $additionnalData = null, $log = true)
 {
     $callables = $this->getEventCallables($event);
     if ($log) {
         $rawData = $bucket->getData();
         $this->getLogger()->log('%s - %s (%d) > %s + %s', $bucket->getSource()->getConnection()->getCurrentNode()->getId(), $event, count($callables), json_encode($rawData, JSON_PRETTY_PRINT), json_encode($additionnalData, JSON_PRETTY_PRINT));
     }
     if ($this->hasEvent($event)) {
         foreach ($callables as $callable) {
             list($module, $method) = $callable;
             if ($this->launchModuleAction($event, $module, $method, $bucket, $additionnalData) === false) {
                 break;
             }
         }
     }
 }