PipesInterface.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Component\Process\Pipes;
  11. /**
  12. * PipesInterface manages descriptors and pipes for the use of proc_open.
  13. *
  14. * @author Romain Neutron <imprec@gmail.com>
  15. *
  16. * @internal
  17. */
  18. interface PipesInterface
  19. {
  20. public const CHUNK_SIZE = 16384;
  21. /**
  22. * Returns an array of descriptors for the use of proc_open.
  23. */
  24. public function getDescriptors(): array;
  25. /**
  26. * Returns an array of filenames indexed by their related stream in case these pipes use temporary files.
  27. *
  28. * @return string[]
  29. */
  30. public function getFiles(): array;
  31. /**
  32. * Reads data in file handles and pipes.
  33. *
  34. * @param bool $blocking Whether to use blocking calls or not
  35. * @param bool $close Whether to close pipes if they've reached EOF
  36. *
  37. * @return string[] An array of read data indexed by their fd
  38. */
  39. public function readAndWrite(bool $blocking, bool $close = false): array;
  40. /**
  41. * Returns if the current state has open file handles or pipes.
  42. */
  43. public function areOpen(): bool;
  44. /**
  45. * Returns if pipes are able to read output.
  46. */
  47. public function haveReadSupport(): bool;
  48. /**
  49. * Closes file handles and pipes.
  50. */
  51. public function close();
  52. }