ProcessResult.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <?php
  2. namespace Illuminate\Contracts\Process;
  3. interface ProcessResult
  4. {
  5. /**
  6. * Get the original command executed by the process.
  7. *
  8. * @return string
  9. */
  10. public function command();
  11. /**
  12. * Determine if the process was successful.
  13. *
  14. * @return bool
  15. */
  16. public function successful();
  17. /**
  18. * Determine if the process failed.
  19. *
  20. * @return bool
  21. */
  22. public function failed();
  23. /**
  24. * Get the exit code of the process.
  25. *
  26. * @return int|null
  27. */
  28. public function exitCode();
  29. /**
  30. * Get the standard output of the process.
  31. *
  32. * @return string
  33. */
  34. public function output();
  35. /**
  36. * Get the error output of the process.
  37. *
  38. * @return string
  39. */
  40. public function errorOutput();
  41. /**
  42. * Throw an exception if the process failed.
  43. *
  44. * @param callable|null $callback
  45. * @return $this
  46. */
  47. public function throw(?callable $callback = null);
  48. /**
  49. * Throw an exception if the process failed and the given condition is true.
  50. *
  51. * @param bool $condition
  52. * @param callable|null $callback
  53. * @return $this
  54. */
  55. public function throwIf(bool $condition, ?callable $callback = null);
  56. }