StreamPlusInterface.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?php
  2. /**
  3. * This file is part of Swow
  4. *
  5. * @link https://github.com/swow/swow
  6. * @contact twosee <twosee@php.net>
  7. *
  8. * For the full copyright and license information,
  9. * please view the LICENSE file that was distributed with this source code
  10. */
  11. declare(strict_types=1);
  12. namespace Swow\Psr7\Message;
  13. use Psr\Http\Message\StreamInterface;
  14. use const SEEK_SET;
  15. interface StreamPlusInterface extends StreamInterface
  16. {
  17. public function getSize(): ?int;
  18. public function tell(): int;
  19. public function eof(): bool;
  20. public function isSeekable(): bool;
  21. /**
  22. * @param int $offset
  23. * @param int $whence
  24. */
  25. public function seek(mixed $offset, mixed $whence = SEEK_SET): void;
  26. public function rewind(): void;
  27. public function isWritable(): bool;
  28. public function write(mixed $string): int;
  29. public function isReadable(): bool;
  30. /** @param int $length */
  31. public function read(mixed $length): string;
  32. public function getContents(): string;
  33. public function getMetadata(mixed $key = null): mixed;
  34. /** @return resource|null */
  35. public function detach(): mixed;
  36. public function close(): void;
  37. public function toString(): string;
  38. }