PipesInterface.php 1.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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. const CHUNK_SIZE = 16384;
  21. /**
  22. * Returns an array of descriptors for the use of proc_open.
  23. *
  24. * @return array
  25. */
  26. public function getDescriptors();
  27. /**
  28. * Returns an array of filenames indexed by their related stream in case these pipes use temporary files.
  29. *
  30. * @return string[]
  31. */
  32. public function getFiles();
  33. /**
  34. * Reads data in file handles and pipes.
  35. *
  36. * @param bool $blocking Whether to use blocking calls or not
  37. * @param bool $close Whether to close pipes if they've reached EOF
  38. *
  39. * @return string[] An array of read data indexed by their fd
  40. */
  41. public function readAndWrite($blocking, $close = false);
  42. /**
  43. * Returns if the current state has open file handles or pipes.
  44. *
  45. * @return bool
  46. */
  47. public function areOpen();
  48. /**
  49. * Returns if pipes are able to read output.
  50. *
  51. * @return bool
  52. */
  53. public function haveReadSupport();
  54. /**
  55. * Closes file handles and pipes.
  56. */
  57. public function close();
  58. }