Queue.php 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <?php
  2. namespace Illuminate\Support\Facades;
  3. use Illuminate\Queue\Worker;
  4. use Illuminate\Support\Testing\Fakes\QueueFake;
  5. /**
  6. * @method static \Illuminate\Contracts\Queue\Job|null pop(string $queue = null)
  7. * @method static \Illuminate\Contracts\Queue\Queue setConnectionName(string $name)
  8. * @method static int size(string $queue = null)
  9. * @method static mixed bulk(array $jobs, mixed $data = '', string $queue = null)
  10. * @method static mixed later(\DateTimeInterface|\DateInterval|int $delay, string|object $job, mixed $data = '', string $queue = null)
  11. * @method static mixed laterOn(string $queue, \DateTimeInterface|\DateInterval|int $delay, string|object $job, mixed $data = '')
  12. * @method static mixed push(string|object $job, mixed $data = '', $queue = null)
  13. * @method static mixed pushOn(string $queue, string|object $job, mixed $data = '')
  14. * @method static mixed pushRaw(string $payload, string $queue = null, array $options = [])
  15. * @method static string getConnectionName()
  16. * @method static void assertNotPushed(string|\Closure $job, callable $callback = null)
  17. * @method static void assertNothingPushed()
  18. * @method static void assertPushed(string|\Closure $job, callable|int $callback = null)
  19. * @method static void assertPushedOn(string $queue, string|\Closure $job, callable $callback = null)
  20. * @method static void assertPushedWithChain(string $job, array $expectedChain = [], callable $callback = null)
  21. *
  22. * @see \Illuminate\Queue\QueueManager
  23. * @see \Illuminate\Queue\Queue
  24. */
  25. class Queue extends Facade
  26. {
  27. /**
  28. * Register a callback to be executed to pick jobs.
  29. *
  30. * @param string $workerName
  31. * @param callable $callback
  32. * @return void
  33. */
  34. public static function popUsing($workerName, $callback)
  35. {
  36. return Worker::popUsing($workerName, $callback);
  37. }
  38. /**
  39. * Replace the bound instance with a fake.
  40. *
  41. * @return \Illuminate\Support\Testing\Fakes\QueueFake
  42. */
  43. public static function fake()
  44. {
  45. static::swap($fake = new QueueFake(static::getFacadeApplication()));
  46. return $fake;
  47. }
  48. /**
  49. * Get the registered name of the component.
  50. *
  51. * @return string
  52. */
  53. protected static function getFacadeAccessor()
  54. {
  55. return 'queue';
  56. }
  57. }