DuplexStreamInterface.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. namespace React\Stream;
  3. /**
  4. * The `DuplexStreamInterface` is responsible for providing an interface for
  5. * duplex streams (both readable and writable).
  6. *
  7. * It builds on top of the existing interfaces for readable and writable streams
  8. * and follows the exact same method and event semantics.
  9. * If you're new to this concept, you should look into the
  10. * `ReadableStreamInterface` and `WritableStreamInterface` first.
  11. *
  12. * Besides defining a few methods, this interface also implements the
  13. * `EventEmitterInterface` which allows you to react to the same events defined
  14. * on the `ReadbleStreamInterface` and `WritableStreamInterface`.
  15. *
  16. * The event callback functions MUST be a valid `callable` that obeys strict
  17. * parameter definitions and MUST accept event parameters exactly as documented.
  18. * The event callback functions MUST NOT throw an `Exception`.
  19. * The return value of the event callback functions will be ignored and has no
  20. * effect, so for performance reasons you're recommended to not return any
  21. * excessive data structures.
  22. *
  23. * Every implementation of this interface MUST follow these event semantics in
  24. * order to be considered a well-behaving stream.
  25. *
  26. * > Note that higher-level implementations of this interface may choose to
  27. * define additional events with dedicated semantics not defined as part of
  28. * this low-level stream specification. Conformance with these event semantics
  29. * is out of scope for this interface, so you may also have to refer to the
  30. * documentation of such a higher-level implementation.
  31. *
  32. * @see ReadableStreamInterface
  33. * @see WritableStreamInterface
  34. */
  35. interface DuplexStreamInterface extends ReadableStreamInterface, WritableStreamInterface
  36. {
  37. }