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