|
6 | 6 | use Illuminate\Support\Defer\DeferredCallbackCollection;
|
7 | 7 | use Illuminate\Support\Process\PhpExecutableFinder;
|
8 | 8 |
|
9 |
| -/** |
10 |
| - * Defer execution of the given callback. |
11 |
| - * |
12 |
| - * @param callable|null $callback |
13 |
| - * @param string|null $name |
14 |
| - * @param bool $always |
15 |
| - * @return \Illuminate\Support\Defer\DeferredCallback |
16 |
| - */ |
17 |
| -function defer(?callable $callback = null, ?string $name = null, bool $always = false) |
18 |
| -{ |
19 |
| - if ($callback === null) { |
20 |
| - return app(DeferredCallbackCollection::class); |
21 |
| - } |
| 9 | +if (! function_exists('Illuminate\Support\defer')) { |
| 10 | + /** |
| 11 | + * Defer execution of the given callback. |
| 12 | + * |
| 13 | + * @param callable|null $callback |
| 14 | + * @param string|null $name |
| 15 | + * @param bool $always |
| 16 | + * @return \Illuminate\Support\Defer\DeferredCallback |
| 17 | + */ |
| 18 | + function defer(?callable $callback = null, ?string $name = null, bool $always = false) |
| 19 | + { |
| 20 | + if ($callback === null) { |
| 21 | + return app(DeferredCallbackCollection::class); |
| 22 | + } |
22 | 23 |
|
23 |
| - return tap( |
24 |
| - new DeferredCallback($callback, $name, $always), |
25 |
| - fn ($deferred) => app(DeferredCallbackCollection::class)[] = $deferred |
26 |
| - ); |
| 24 | + return tap( |
| 25 | + new DeferredCallback($callback, $name, $always), |
| 26 | + fn ($deferred) => app(DeferredCallbackCollection::class)[] = $deferred |
| 27 | + ); |
| 28 | + } |
27 | 29 | }
|
28 | 30 |
|
29 |
| -/** |
30 |
| - * Determine the PHP Binary. |
31 |
| - * |
32 |
| - * @return string |
33 |
| - */ |
34 |
| -function php_binary() |
35 |
| -{ |
36 |
| - return (new PhpExecutableFinder)->find(false) ?: 'php'; |
| 31 | +if (! function_exists('Illuminate\Support\php_binary')) { |
| 32 | + /** |
| 33 | + * Determine the PHP Binary. |
| 34 | + * |
| 35 | + * @return string |
| 36 | + */ |
| 37 | + function php_binary() |
| 38 | + { |
| 39 | + return (new PhpExecutableFinder)->find(false) ?: 'php'; |
| 40 | + } |
37 | 41 | }
|
0 commit comments