X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fseekat;a=blobdiff_plain;f=examples%2Famploop.php;fp=examples%2Famploop.php;h=1abbaa11e42d264dacaf4478607f1f6d49ea2bb2;hp=5ecdd0dfe232d9d6ac4261b9a3d525b3b676d77a;hb=2121556150be871684b5046af7cf250b8219128d;hpb=cac6bea94e6cde142c951566fa6387ffa54eb3cb diff --git a/examples/amploop.php b/examples/amploop.php index 5ecdd0d..1abbaa1 100755 --- a/examples/amploop.php +++ b/examples/amploop.php @@ -84,12 +84,14 @@ $cli->configure([ $this->driver->setState((string) $socket, $id); break; case self::POLL_INOUT: - $id[] = $this->driver->onReadable($socket, function($id, $socket) { - $this->run($socket, self::POLL_IN); - }); - $id[] = $this->driver->onWritable($socket, function($id, $socket) { - $this->run($socket, self::POLL_OUT); - }); + $id = [ + $this->driver->onReadable($socket, function($id, $socket) { + $this->run($socket, self::POLL_IN); + }), + $this->driver->onWritable($socket, function($id, $socket) { + $this->run($socket, self::POLL_OUT); + }) + ]; $this->driver->setState((string) $socket, $id); break; case self::POLL_REMOVE: @@ -110,4 +112,4 @@ AmpLoop::run(function() use($api) { list($m6w6, $seekat) = yield [$api->users->m6w6(), $api->repos->m6w6->seekat()]; printf("Hi, my name is %s!\n", $m6w6->login); printf("Have fun with %s; %s!\n", $seekat->name, $seekat->description); -}); \ No newline at end of file +});