Beispiel #1
0
 public function run()
 {
     $this->console->writeLn("Starting server..");
     $this->setState('start', $e = new observr\Event($this));
     if ($e->isCanceled()) {
         $message = isset($e->message) ? $e->message : 'Unknown reason';
         $this->console->writeLn('Server start failed.. "' . $message . '"');
     } else {
         $this->console->writeLn('Server started.');
         $this->provider->getIO()->run();
         $this->console->writeLn('Shutting down..');
     }
 }
Beispiel #2
0
 function testEmptyEventAfter()
 {
     $user = new Mock\User();
     $e = new observr\Event($user);
     $match = ['complete', 'success', 'complete', 'success', 'complete', 'success'];
     $results = [];
     $e->attach(observr\Event::COMPLETE, function () use(&$results) {
         $results[] = 'complete';
     });
     $e->attach(observr\Event::CANCEL, function () use(&$results) {
         $results[] = 'canceled';
     });
     $e->attach(observr\Event::FAILURE, function () use(&$results) {
         $results[] = 'failure';
     });
     $e->attach(observr\Event::SUCCESS, function () use(&$results) {
         $results[] = 'success';
     });
     $user->setState('editprofile', $e);
     $user->setState('logout', $e);
     $user->setState('login', $e);
     $this->assertEquals($match, $results);
 }
Beispiel #3
0
 public function __construct($sender, qtcp\Network\Packet $packet)
 {
     parent::__construct($sender, ['packet' => $packet, 'data' => $packet->getData(), 'id' => $packet->getID()]);
 }