-
Notifications
You must be signed in to change notification settings - Fork 162
/
functions.php
41 lines (36 loc) · 1.08 KB
/
functions.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php
namespace Illuminate\Support;
use Illuminate\Support\Defer\DeferredCallback;
use Illuminate\Support\Defer\DeferredCallbackCollection;
use Illuminate\Support\Process\PhpExecutableFinder;
if (! function_exists('Illuminate\Support\defer')) {
/**
* Defer execution of the given callback.
*
* @param callable|null $callback
* @param string|null $name
* @param bool $always
* @return \Illuminate\Support\Defer\DeferredCallback
*/
function defer(?callable $callback = null, ?string $name = null, bool $always = false)
{
if ($callback === null) {
return app(DeferredCallbackCollection::class);
}
return tap(
new DeferredCallback($callback, $name, $always),
fn ($deferred) => app(DeferredCallbackCollection::class)[] = $deferred
);
}
}
if (! function_exists('Illuminate\Support\php_binary')) {
/**
* Determine the PHP Binary.
*
* @return string
*/
function php_binary()
{
return (new PhpExecutableFinder)->find(false) ?: 'php';
}
}