截流自动化的商城平台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

StreamFactoryInterface.php 1.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. namespace Psr\Http\Message;
  3. interface StreamFactoryInterface
  4. {
  5. /**
  6. * Create a new stream from a string.
  7. *
  8. * The stream SHOULD be created with a temporary resource.
  9. *
  10. * @param string $content String content with which to populate the stream.
  11. *
  12. * @return StreamInterface
  13. */
  14. public function createStream(string $content = ''): StreamInterface;
  15. /**
  16. * Create a stream from an existing file.
  17. *
  18. * The file MUST be opened using the given mode, which may be any mode
  19. * supported by the `fopen` function.
  20. *
  21. * The `$filename` MAY be any string supported by `fopen()`.
  22. *
  23. * @param string $filename Filename or stream URI to use as basis of stream.
  24. * @param string $mode Mode with which to open the underlying filename/stream.
  25. *
  26. * @return StreamInterface
  27. * @throws \RuntimeException If the file cannot be opened.
  28. * @throws \InvalidArgumentException If the mode is invalid.
  29. */
  30. public function createStreamFromFile(string $filename, string $mode = 'r'): StreamInterface;
  31. /**
  32. * Create a new stream from an existing resource.
  33. *
  34. * The stream MUST be readable and may be writable.
  35. *
  36. * @param resource $resource PHP resource to use as basis of stream.
  37. *
  38. * @return StreamInterface
  39. */
  40. public function createStreamFromResource($resource): StreamInterface;
  41. }