32 $this->assertEquals(1, $check);
47 $this->assertEquals(1, $check);
72 $this->assertEquals([
'b',
'a',
'c'], $check);
80 $intervalId =
setInterval(
function() use (&$check, &$intervalId) {
90 $this->assertEquals(6, $check);
99 fwrite(
$h,
'hello world');
105 $this->assertEquals(
'hello world', stream_get_contents(
$h));
111 $h =
fopen(
'php://temp',
'r+');
112 fwrite(
$h,
'hello world');
124 $this->assertEquals(
'hello world',
$result);
140 $this->assertEquals(0, $check);
156 $this->assertEquals(1, $check);
addWriteStream($stream, callable $cb)
Adds a write stream.
removeWriteStream($stream)
Stop watching a stream for writes.
stop()
Stops a running eventloop.
setTimeout(callable $cb, $timeout)
Executes a function after x seconds.
clearInterval($intervalId)
Stops a running internval.
removeReadStream($stream)
Stop watching a stream for reads.
addReadStream($stream, callable $cb)
Adds a read stream.
nextTick(callable $cb)
Runs a function immediately at the next iteration of the loop.
instance(Loop $newLoop=null)
Retrieves or sets the global Loop object.
setInterval(callable $cb, $timeout)
Executes a function every x seconds.
tick($block=false)
Executes all pending events.
A simple eventloop implementation.