mirror of
https://github.com/danog/amp.git
synced 2024-12-03 09:57:51 +01:00
Add missing documentation
This commit is contained in:
parent
a31f5188cc
commit
3791a7536a
@ -7,6 +7,11 @@ use Interop\Async\Loop\DriverFactory;
|
|||||||
use Interop\Async\Loop\InvalidWatcherException;
|
use Interop\Async\Loop\InvalidWatcherException;
|
||||||
use Interop\Async\Loop\UnsupportedFeatureException;
|
use Interop\Async\Loop\UnsupportedFeatureException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Accessor to allow global access to the event loop.
|
||||||
|
*
|
||||||
|
* @see \Interop\Async\Loop\Driver
|
||||||
|
*/
|
||||||
final class Loop
|
final class Loop
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
@ -2,6 +2,9 @@
|
|||||||
|
|
||||||
namespace Interop\Async\Loop;
|
namespace Interop\Async\Loop;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Event loop driver which implements all basic operations to allow interoperability.
|
||||||
|
*/
|
||||||
abstract class Driver
|
abstract class Driver
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
@ -106,8 +109,8 @@ abstract class Driver
|
|||||||
* Multiple watchers on the same signal may be executed in any order.
|
* Multiple watchers on the same signal may be executed in any order.
|
||||||
*
|
*
|
||||||
* NOTE: Installing a same signal on different instances of this interface is deemed undefined behavior.
|
* NOTE: Installing a same signal on different instances of this interface is deemed undefined behavior.
|
||||||
* Implementations may try to detect this, if possible, but are not required to.
|
* Implementations may try to detect this, if possible, but are not required to. This is due to technical
|
||||||
* This is due to technical limitations of the signals being registered globally per process.
|
* limitations of the signals being registered globally per process.
|
||||||
*
|
*
|
||||||
* @param int $signo The signal number to monitor.
|
* @param int $signo The signal number to monitor.
|
||||||
* @param callable(string $watcherId, int $signo, mixed $data) $callback The callback to execute.
|
* @param callable(string $watcherId, int $signo, mixed $data) $callback The callback to execute.
|
||||||
@ -188,8 +191,8 @@ abstract class Driver
|
|||||||
*
|
*
|
||||||
* Therefore packages SHOULD use the following prefix to keys: `vendor.package.`
|
* Therefore packages SHOULD use the following prefix to keys: `vendor.package.`
|
||||||
*
|
*
|
||||||
* @param string $key namespaced storage key
|
* @param string $key The namespaced storage key.
|
||||||
* @param mixed $value the value to be stored
|
* @param mixed $value The value to be stored.
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
@ -208,9 +211,9 @@ abstract class Driver
|
|||||||
*
|
*
|
||||||
* Therefore packages SHOULD use the following prefix to keys: `vendor.package.`
|
* Therefore packages SHOULD use the following prefix to keys: `vendor.package.`
|
||||||
*
|
*
|
||||||
* @param string $key namespaced storage key
|
* @param string $key The namespaced storage key.
|
||||||
*
|
*
|
||||||
* @return mixed previously stored value or null if it doesn't exist
|
* @return mixed The previously stored value or null if it doesn't exist.
|
||||||
*/
|
*/
|
||||||
final public function getState($key)
|
final public function getState($key)
|
||||||
{
|
{
|
||||||
@ -234,15 +237,15 @@ abstract class Driver
|
|||||||
*
|
*
|
||||||
* The returned array MUST contain the following data describing the driver's currently registered watchers:
|
* The returned array MUST contain the following data describing the driver's currently registered watchers:
|
||||||
*
|
*
|
||||||
* [
|
* [
|
||||||
* "defer" => ["enabled" => int, "disabled" => int],
|
* "defer" => ["enabled" => int, "disabled" => int],
|
||||||
* "delay" => ["enabled" => int, "disabled" => int],
|
* "delay" => ["enabled" => int, "disabled" => int],
|
||||||
* "repeat" => ["enabled" => int, "disabled" => int],
|
* "repeat" => ["enabled" => int, "disabled" => int],
|
||||||
* "on_readable" => ["enabled" => int, "disabled" => int],
|
* "on_readable" => ["enabled" => int, "disabled" => int],
|
||||||
* "on_writable" => ["enabled" => int, "disabled" => int],
|
* "on_writable" => ["enabled" => int, "disabled" => int],
|
||||||
* "on_signal" => ["enabled" => int, "disabled" => int],
|
* "on_signal" => ["enabled" => int, "disabled" => int],
|
||||||
* "watchers" => ["referenced" => int, "unreferenced" => int],
|
* "watchers" => ["referenced" => int, "unreferenced" => int],
|
||||||
* ];
|
* ];
|
||||||
*
|
*
|
||||||
* Implementations MAY optionally add more information in the array but at minimum the above key => value format
|
* Implementations MAY optionally add more information in the array but at minimum the above key => value format
|
||||||
* MUST always be provided.
|
* MUST always be provided.
|
||||||
@ -254,9 +257,9 @@ abstract class Driver
|
|||||||
/**
|
/**
|
||||||
* Get the underlying loop handle.
|
* Get the underlying loop handle.
|
||||||
*
|
*
|
||||||
* Example: the uv_loop resource for libuv or the EvLoop object for libev or null for a native driver
|
* Example: the uv_loop resource for libuv or the EvLoop object for libev or null for a native driver.
|
||||||
*
|
*
|
||||||
* Note: This function is *not* exposed in the Loop class; users shall access it directly on the respective loop
|
* NOTE: This function is *not* exposed in the Loop class. Users shall access it directly on the respective loop
|
||||||
* instance.
|
* instance.
|
||||||
*
|
*
|
||||||
* @return null|object|resource The loop handle the event loop operates on. Null if there is none.
|
* @return null|object|resource The loop handle the event loop operates on. Null if there is none.
|
||||||
|
@ -2,6 +2,11 @@
|
|||||||
|
|
||||||
namespace Interop\Async\Loop;
|
namespace Interop\Async\Loop;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Allows creating new driver instances.
|
||||||
|
*
|
||||||
|
* @see \Interop\Async\Loop::setFactory()
|
||||||
|
*/
|
||||||
interface DriverFactory
|
interface DriverFactory
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user