| 148 |
lars |
1 |
<?php
|
|
|
2 |
|
|
|
3 |
namespace Illuminate\Support\Facades;
|
|
|
4 |
|
|
|
5 |
use Illuminate\Queue\Worker;
|
|
|
6 |
use Illuminate\Support\Testing\Fakes\QueueFake;
|
|
|
7 |
|
|
|
8 |
/**
|
|
|
9 |
* @method static void before(mixed $callback)
|
|
|
10 |
* @method static void after(mixed $callback)
|
|
|
11 |
* @method static void exceptionOccurred(mixed $callback)
|
|
|
12 |
* @method static void looping(mixed $callback)
|
|
|
13 |
* @method static void failing(mixed $callback)
|
|
|
14 |
* @method static void stopping(mixed $callback)
|
|
|
15 |
* @method static bool connected(string|null $name = null)
|
|
|
16 |
* @method static \Illuminate\Contracts\Queue\Queue connection(string|null $name = null)
|
|
|
17 |
* @method static void extend(string $driver, \Closure $resolver)
|
|
|
18 |
* @method static void addConnector(string $driver, \Closure $resolver)
|
|
|
19 |
* @method static string getDefaultDriver()
|
|
|
20 |
* @method static void setDefaultDriver(string $name)
|
|
|
21 |
* @method static string getName(string|null $connection = null)
|
|
|
22 |
* @method static \Illuminate\Contracts\Foundation\Application getApplication()
|
|
|
23 |
* @method static \Illuminate\Queue\QueueManager setApplication(\Illuminate\Contracts\Foundation\Application $app)
|
|
|
24 |
* @method static int size(string|null $queue = null)
|
|
|
25 |
* @method static mixed push(string|object $job, mixed $data = '', string|null $queue = null)
|
|
|
26 |
* @method static mixed pushOn(string $queue, string|object $job, mixed $data = '')
|
|
|
27 |
* @method static mixed pushRaw(string $payload, string|null $queue = null, array $options = [])
|
|
|
28 |
* @method static mixed later(\DateTimeInterface|\DateInterval|int $delay, string|object $job, mixed $data = '', string|null $queue = null)
|
|
|
29 |
* @method static mixed laterOn(string $queue, \DateTimeInterface|\DateInterval|int $delay, string|object $job, mixed $data = '')
|
|
|
30 |
* @method static mixed bulk(array $jobs, mixed $data = '', string|null $queue = null)
|
|
|
31 |
* @method static \Illuminate\Contracts\Queue\Job|null pop(string|null $queue = null)
|
|
|
32 |
* @method static string getConnectionName()
|
|
|
33 |
* @method static \Illuminate\Contracts\Queue\Queue setConnectionName(string $name)
|
|
|
34 |
* @method static mixed getJobBackoff(mixed $job)
|
|
|
35 |
* @method static mixed getJobExpiration(mixed $job)
|
|
|
36 |
* @method static void createPayloadUsing(callable|null $callback)
|
|
|
37 |
* @method static \Illuminate\Container\Container getContainer()
|
|
|
38 |
* @method static void setContainer(\Illuminate\Container\Container $container)
|
|
|
39 |
* @method static \Illuminate\Support\Testing\Fakes\QueueFake except(array|string $jobsToBeQueued)
|
|
|
40 |
* @method static void assertPushed(string|\Closure $job, callable|int|null $callback = null)
|
|
|
41 |
* @method static void assertPushedOn(string $queue, string|\Closure $job, callable|null $callback = null)
|
|
|
42 |
* @method static void assertPushedWithChain(string $job, array $expectedChain = [], callable|null $callback = null)
|
|
|
43 |
* @method static void assertPushedWithoutChain(string $job, callable|null $callback = null)
|
|
|
44 |
* @method static void assertNotPushed(string|\Closure $job, callable|null $callback = null)
|
|
|
45 |
* @method static void assertNothingPushed()
|
|
|
46 |
* @method static \Illuminate\Support\Collection pushed(string $job, callable|null $callback = null)
|
|
|
47 |
* @method static bool hasPushed(string $job)
|
|
|
48 |
* @method static bool shouldFakeJob(object $job)
|
|
|
49 |
* @method static array pushedJobs()
|
|
|
50 |
*
|
|
|
51 |
* @see \Illuminate\Queue\QueueManager
|
|
|
52 |
* @see \Illuminate\Queue\Queue
|
|
|
53 |
* @see \Illuminate\Support\Testing\Fakes\QueueFake
|
|
|
54 |
*/
|
|
|
55 |
class Queue extends Facade
|
|
|
56 |
{
|
|
|
57 |
/**
|
|
|
58 |
* Register a callback to be executed to pick jobs.
|
|
|
59 |
*
|
|
|
60 |
* @param string $workerName
|
|
|
61 |
* @param callable $callback
|
|
|
62 |
* @return void
|
|
|
63 |
*/
|
|
|
64 |
public static function popUsing($workerName, $callback)
|
|
|
65 |
{
|
|
|
66 |
return Worker::popUsing($workerName, $callback);
|
|
|
67 |
}
|
|
|
68 |
|
|
|
69 |
/**
|
|
|
70 |
* Replace the bound instance with a fake.
|
|
|
71 |
*
|
|
|
72 |
* @param array|string $jobsToFake
|
|
|
73 |
* @return \Illuminate\Support\Testing\Fakes\QueueFake
|
|
|
74 |
*/
|
|
|
75 |
public static function fake($jobsToFake = [])
|
|
|
76 |
{
|
|
|
77 |
static::swap($fake = new QueueFake(static::getFacadeApplication(), $jobsToFake, static::getFacadeRoot()));
|
|
|
78 |
|
|
|
79 |
return $fake;
|
|
|
80 |
}
|
|
|
81 |
|
|
|
82 |
/**
|
|
|
83 |
* Get the registered name of the component.
|
|
|
84 |
*
|
|
|
85 |
* @return string
|
|
|
86 |
*/
|
|
|
87 |
protected static function getFacadeAccessor()
|
|
|
88 |
{
|
|
|
89 |
return 'queue';
|
|
|
90 |
}
|
|
|
91 |
}
|