| 1 | <?php |
| 2 | |
| 3 | namespace Illuminate\Support\Facades; |
| 4 | |
| 5 | use Closure; |
| 6 | use Illuminate\Process\Factory; |
| 7 | |
| 8 | /** |
| 9 | * @method static \Illuminate\Process\PendingProcess command(array|string $command) |
| 10 | * @method static \Illuminate\Process\PendingProcess path(string $path) |
| 11 | * @method static \Illuminate\Process\PendingProcess timeout(int $timeout) |
| 12 | * @method static \Illuminate\Process\PendingProcess idleTimeout(int $timeout) |
| 13 | * @method static \Illuminate\Process\PendingProcess forever() |
| 14 | * @method static \Illuminate\Process\PendingProcess env(array $environment) |
| 15 | * @method static \Illuminate\Process\PendingProcess input(\Traversable|resource|string|int|float|bool|null $input) |
| 16 | * @method static \Illuminate\Process\PendingProcess quietly() |
| 17 | * @method static \Illuminate\Process\PendingProcess tty(bool $tty = true) |
| 18 | * @method static \Illuminate\Process\PendingProcess options(array $options) |
| 19 | * @method static \Illuminate\Contracts\Process\ProcessResult run(array|string|null $command = null, callable|null $output = null) |
| 20 | * @method static \Illuminate\Process\InvokedProcess start(array|string|null $command = null, callable|null $output = null) |
| 21 | * @method static bool supportsTty() |
| 22 | * @method static \Illuminate\Process\PendingProcess withFakeHandlers(array $fakeHandlers) |
| 23 | * @method static \Illuminate\Process\PendingProcess|mixed when(\Closure|mixed|null $value = null, callable|null $callback = null, callable|null $default = null) |
| 24 | * @method static \Illuminate\Process\PendingProcess|mixed unless(\Closure|mixed|null $value = null, callable|null $callback = null, callable|null $default = null) |
| 25 | * @method static \Illuminate\Process\FakeProcessResult result(array|string $output = '', array|string $errorOutput = '', int $exitCode = 0) |
| 26 | * @method static \Illuminate\Process\FakeProcessDescription describe() |
| 27 | * @method static \Illuminate\Process\FakeProcessSequence sequence(array $processes = []) |
| 28 | * @method static bool isRecording() |
| 29 | * @method static \Illuminate\Process\Factory recordIfRecording(\Illuminate\Process\PendingProcess $process, \Illuminate\Contracts\Process\ProcessResult $result) |
| 30 | * @method static \Illuminate\Process\Factory record(\Illuminate\Process\PendingProcess $process, \Illuminate\Contracts\Process\ProcessResult $result) |
| 31 | * @method static \Illuminate\Process\Factory preventStrayProcesses(bool $prevent = true) |
| 32 | * @method static bool preventingStrayProcesses() |
| 33 | * @method static \Illuminate\Process\Factory assertRan(\Closure|string $callback) |
| 34 | * @method static \Illuminate\Process\Factory assertRanTimes(\Closure|string $callback, int $times = 1) |
| 35 | * @method static \Illuminate\Process\Factory assertNotRan(\Closure|string $callback) |
| 36 | * @method static \Illuminate\Process\Factory assertDidntRun(\Closure|string $callback) |
| 37 | * @method static \Illuminate\Process\Factory assertNothingRan() |
| 38 | * @method static \Illuminate\Process\Pool pool(callable $callback) |
| 39 | * @method static \Illuminate\Contracts\Process\ProcessResult pipe(callable|array $callback, callable|null $output = null) |
| 40 | * @method static \Illuminate\Process\ProcessPoolResults concurrently(callable $callback, callable|null $output = null) |
| 41 | * @method static \Illuminate\Process\PendingProcess newPendingProcess() |
| 42 | * @method static void macro(string $name, object|callable $macro) |
| 43 | * @method static void mixin(object $mixin, bool $replace = true) |
| 44 | * @method static bool hasMacro(string $name) |
| 45 | * @method static void flushMacros() |
| 46 | * @method static mixed macroCall(string $method, array $parameters) |
| 47 | * |
| 48 | * @see \Illuminate\Process\PendingProcess |
| 49 | * @see \Illuminate\Process\Factory |
| 50 | */ |
| 51 | class Process extends Facade |
| 52 | { |
| 53 | /** |
| 54 | * Get the registered name of the component. |
| 55 | * |
| 56 | * @return string |
| 57 | */ |
| 58 | protected static function getFacadeAccessor() |
| 59 | { |
| 60 | return Factory::class; |
| 61 | } |
| 62 | |
| 63 | /** |
| 64 | * Indicate that the process factory should fake processes. |
| 65 | * |
| 66 | * @param \Closure|array|null $callback |
| 67 | * @return \Illuminate\Process\Factory |
| 68 | */ |
| 69 | public static function fake(Closure|array|null $callback = null) |
| 70 | { |
| 71 | return tap(static::getFacadeRoot(), function ($fake) use ($callback) { |
| 72 | static::swap($fake->fake($callback)); |
| 73 | }); |
| 74 | } |
| 75 | } |