1
0
mirror of https://github.com/danog/amp.git synced 2024-11-30 04:29:08 +01:00

Improved documentation

This commit is contained in:
Daniel Lowrey 2013-11-27 12:05:08 -05:00
parent 5742c74a43
commit c68ac138bb

View File

@ -22,6 +22,9 @@ interface Reactor {
/**
* Schedule a callback for immediate invocation in the next event loop iteration
*
* Though it can't be enforced at the interface level all timer/stream scheduling methods
* should return a unique integer identifying the relevant watcher.
*
* @param callable $callback Any valid PHP callable
*/
function immediately(callable $callback);
@ -29,6 +32,12 @@ interface Reactor {
/**
* Schedule a callback to execute once
*
* Time intervals are measured in seconds. Floating point values < 0 denote intervals less than
* one second. e.g. $interval = 0.001 means a one millisecond interval.
*
* Though it can't be enforced at the interface level all timer/stream scheduling methods
* should return a unique integer identifying the relevant watcher.
*
* @param callable $callback Any valid PHP callable
* @param float $delay The delay in seconds before the callback will be invoked (zero is allowed)
*/
@ -37,6 +46,12 @@ interface Reactor {
/**
* Schedule a recurring callback to execute every $interval seconds until cancelled
*
* Time intervals are measured in seconds. Floating point values < 0 denote intervals less than
* one second. e.g. $interval = 0.001 means a one millisecond interval.
*
* Though it can't be enforced at the interface level all timer/stream scheduling methods
* should return a unique integer identifying the relevant watcher.
*
* @param callable $callback Any valid PHP callable
* @param float $interval The interval in seconds to observe between callback executions (zero is allowed)
*/
@ -45,6 +60,9 @@ interface Reactor {
/**
* Schedule an event to trigger once at the specified time
*
* Though it can't be enforced at the interface level all timer/stream scheduling methods
* should return a unique integer identifying the relevant watcher.
*
* @param callable $callback Any valid PHP callable
* @param string $timeString Any string that can be parsed by strtotime() and is in the future
*/
@ -53,6 +71,9 @@ interface Reactor {
/**
* Watch a stream resource for IO readable data and trigger the callback when actionable
*
* Though it can't be enforced at the interface level all timer/stream scheduling methods
* should return a unique integer identifying the relevant watcher.
*
* @param resource $stream A stream resource to watch for readable data
* @param callable $callback Any valid PHP callable
* @param bool $enableNow Should the watcher be enabled now or held for later use?
@ -62,6 +83,9 @@ interface Reactor {
/**
* Watch a stream resource to become writable and trigger the callback when actionable
*
* Though it can't be enforced at the interface level all timer/stream scheduling methods
* should return a unique integer identifying the relevant watcher.
*
* @param resource $stream A stream resource to watch for writability
* @param callable $callback Any valid PHP callable
* @param bool $enableNow Should the watcher be enabled now or held for later use?