This commit is contained in:
2024-07-03 14:41:15 +03:00
commit ec69208f05
1892 changed files with 181728 additions and 0 deletions

View File

@ -0,0 +1,22 @@
<?php
namespace Illuminate\Contracts\Queue;
use InvalidArgumentException;
class EntityNotFoundException extends InvalidArgumentException
{
/**
* Create a new exception instance.
*
* @param string $type
* @param mixed $id
* @return void
*/
public function __construct($type, $id)
{
$id = (string) $id;
parent::__construct("Queueable entity [{$type}] not found for ID [{$id}].");
}
}

View File

@ -0,0 +1,15 @@
<?php
namespace Illuminate\Contracts\Queue;
interface EntityResolver
{
/**
* Resolve the entity for the given ID.
*
* @param string $type
* @param mixed $id
* @return mixed
*/
public function resolve($type, $id);
}

View File

@ -0,0 +1,14 @@
<?php
namespace Illuminate\Contracts\Queue;
interface Factory
{
/**
* Resolve a queue connection instance.
*
* @param string|null $name
* @return \Illuminate\Contracts\Queue\Queue
*/
public function connection($name = null);
}

View File

@ -0,0 +1,166 @@
<?php
namespace Illuminate\Contracts\Queue;
interface Job
{
/**
* Get the UUID of the job.
*
* @return string|null
*/
public function uuid();
/**
* Get the job identifier.
*
* @return string
*/
public function getJobId();
/**
* Get the decoded body of the job.
*
* @return array
*/
public function payload();
/**
* Fire the job.
*
* @return void
*/
public function fire();
/**
* Release the job back into the queue.
*
* Accepts a delay specified in seconds.
*
* @param int $delay
* @return void
*/
public function release($delay = 0);
/**
* Determine if the job was released back into the queue.
*
* @return bool
*/
public function isReleased();
/**
* Delete the job from the queue.
*
* @return void
*/
public function delete();
/**
* Determine if the job has been deleted.
*
* @return bool
*/
public function isDeleted();
/**
* Determine if the job has been deleted or released.
*
* @return bool
*/
public function isDeletedOrReleased();
/**
* Get the number of times the job has been attempted.
*
* @return int
*/
public function attempts();
/**
* Determine if the job has been marked as a failure.
*
* @return bool
*/
public function hasFailed();
/**
* Mark the job as "failed".
*
* @return void
*/
public function markAsFailed();
/**
* Delete the job, call the "failed" method, and raise the failed job event.
*
* @param \Throwable|null $e
* @return void
*/
public function fail($e = null);
/**
* Get the number of times to attempt a job.
*
* @return int|null
*/
public function maxTries();
/**
* Get the maximum number of exceptions allowed, regardless of attempts.
*
* @return int|null
*/
public function maxExceptions();
/**
* Get the number of seconds the job can run.
*
* @return int|null
*/
public function timeout();
/**
* Get the timestamp indicating when the job should timeout.
*
* @return int|null
*/
public function timeoutAt();
/**
* Get the name of the queued job class.
*
* @return string
*/
public function getName();
/**
* Get the resolved name of the queued job class.
*
* Resolves the name of "wrapped" jobs such as class-based handlers.
*
* @return string
*/
public function resolveName();
/**
* Get the name of the connection the job belongs to.
*
* @return string
*/
public function getConnectionName();
/**
* Get the name of the queue the job belongs to.
*
* @return string
*/
public function getQueue();
/**
* Get the raw body string for the job.
*
* @return string
*/
public function getRawBody();
}

View File

@ -0,0 +1,30 @@
<?php
namespace Illuminate\Contracts\Queue;
interface Monitor
{
/**
* Register a callback to be executed on every iteration through the queue loop.
*
* @param mixed $callback
* @return void
*/
public function looping($callback);
/**
* Register a callback to be executed when a job fails after the maximum amount of retries.
*
* @param mixed $callback
* @return void
*/
public function failing($callback);
/**
* Register a callback to be executed when a daemon queue is stopping.
*
* @param mixed $callback
* @return void
*/
public function stopping($callback);
}

View File

@ -0,0 +1,99 @@
<?php
namespace Illuminate\Contracts\Queue;
interface Queue
{
/**
* Get the size of the queue.
*
* @param string|null $queue
* @return int
*/
public function size($queue = null);
/**
* Push a new job onto the queue.
*
* @param string|object $job
* @param mixed $data
* @param string|null $queue
* @return mixed
*/
public function push($job, $data = '', $queue = null);
/**
* Push a new job onto the queue.
*
* @param string $queue
* @param string|object $job
* @param mixed $data
* @return mixed
*/
public function pushOn($queue, $job, $data = '');
/**
* Push a raw payload onto the queue.
*
* @param string $payload
* @param string|null $queue
* @param array $options
* @return mixed
*/
public function pushRaw($payload, $queue = null, array $options = []);
/**
* Push a new job onto the queue after a delay.
*
* @param \DateTimeInterface|\DateInterval|int $delay
* @param string|object $job
* @param mixed $data
* @param string|null $queue
* @return mixed
*/
public function later($delay, $job, $data = '', $queue = null);
/**
* Push a new job onto the queue after a delay.
*
* @param string $queue
* @param \DateTimeInterface|\DateInterval|int $delay
* @param string|object $job
* @param mixed $data
* @return mixed
*/
public function laterOn($queue, $delay, $job, $data = '');
/**
* Push an array of jobs onto the queue.
*
* @param array $jobs
* @param mixed $data
* @param string|null $queue
* @return mixed
*/
public function bulk($jobs, $data = '', $queue = null);
/**
* Pop the next job off of the queue.
*
* @param string|null $queue
* @return \Illuminate\Contracts\Queue\Job|null
*/
public function pop($queue = null);
/**
* Get the connection name for the queue.
*
* @return string
*/
public function getConnectionName();
/**
* Set the connection name for the queue.
*
* @param string $name
* @return $this
*/
public function setConnectionName($name);
}

View File

@ -0,0 +1,34 @@
<?php
namespace Illuminate\Contracts\Queue;
interface QueueableCollection
{
/**
* Get the type of the entities being queued.
*
* @return string|null
*/
public function getQueueableClass();
/**
* Get the identifiers for all of the entities.
*
* @return array
*/
public function getQueueableIds();
/**
* Get the relationships of the entities being queued.
*
* @return array
*/
public function getQueueableRelations();
/**
* Get the connection of the entities being queued.
*
* @return string|null
*/
public function getQueueableConnection();
}

View File

@ -0,0 +1,27 @@
<?php
namespace Illuminate\Contracts\Queue;
interface QueueableEntity
{
/**
* Get the queueable identity for the entity.
*
* @return mixed
*/
public function getQueueableId();
/**
* Get the relationships for the entity.
*
* @return array
*/
public function getQueueableRelations();
/**
* Get the connection of the entity.
*
* @return string|null
*/
public function getQueueableConnection();
}

View File

@ -0,0 +1,8 @@
<?php
namespace Illuminate\Contracts\Queue;
interface ShouldQueue
{
//
}