summaryrefslogtreecommitdiff
path: root/vendor/fguillot/simple-queue/src/Adapter/MemoryQueueAdapter.php
diff options
context:
space:
mode:
authorFrédéric Guillot <fred@kanboard.net>2018-04-04 15:21:13 -0700
committerFrédéric Guillot <fred@kanboard.net>2018-04-04 15:21:13 -0700
commita4642d17e0e1ea018b128efdcc3db281461458b1 (patch)
tree00210c3d0abd0adea7f8817e6ba1d82c1ea4b50e /vendor/fguillot/simple-queue/src/Adapter/MemoryQueueAdapter.php
parent62178b1f2b4ad6ed8eafbcd3be8ef2f46b041b82 (diff)
Move custom libs to the source tree
Diffstat (limited to 'vendor/fguillot/simple-queue/src/Adapter/MemoryQueueAdapter.php')
-rw-r--r--vendor/fguillot/simple-queue/src/Adapter/MemoryQueueAdapter.php100
1 files changed, 0 insertions, 100 deletions
diff --git a/vendor/fguillot/simple-queue/src/Adapter/MemoryQueueAdapter.php b/vendor/fguillot/simple-queue/src/Adapter/MemoryQueueAdapter.php
deleted file mode 100644
index 36375d5b..00000000
--- a/vendor/fguillot/simple-queue/src/Adapter/MemoryQueueAdapter.php
+++ /dev/null
@@ -1,100 +0,0 @@
-<?php
-
-namespace SimpleQueue\Adapter;
-
-use DateTime;
-use Exception;
-use SimpleQueue\Exception\NotSupportedException;
-use SimpleQueue\QueueAdapterInterface;
-use SimpleQueue\Job;
-use SplQueue;
-
-/**
- * Class MemoryAdapter
- *
- * @package SimpleQueue\Adapter
- */
-class MemoryQueueAdapter implements QueueAdapterInterface
-{
- /**
- * @var SplQueue
- */
- protected $queue;
-
- /**
- * MemoryAdapter constructor.
- */
- public function __construct()
- {
- $this->queue = new SplQueue();
- }
-
- /**
- * Send a job
- *
- * @access public
- * @param Job $job
- * @return $this
- */
- public function push(Job $job)
- {
- $this->queue->enqueue($job->serialize());
- return $this;
- }
-
- /**
- * Schedule a job in the future
- *
- * @access public
- * @param Job $job
- * @param DateTime $dateTime
- * @return bool
- * @throws NotSupportedException
- */
- public function schedule(Job $job, DateTime $dateTime)
- {
- throw new NotSupportedException('Job delay is not supported by MemoryQueue');
- }
-
- /**
- * Wait and get job from a queue
- *
- * @access public
- * @return Job|null
- */
- public function pull()
- {
- try {
- $job = new Job();
- $payload = $this->queue->dequeue();
- return $job->unserialize($payload);
- } catch (Exception $e) {
- return null;
- }
- }
-
- /**
- * Acknowledge a job
- *
- * @access public
- * @param Job $job
- * @return $this
- */
- public function completed(Job $job)
- {
- return $this;
- }
-
- /**
- * Mark a job as failed
- *
- * @access public
- * @param Job $job
- * @return $this
- */
- public function failed(Job $job)
- {
- $this->queue->enqueue($job->serialize());
- return $this;
- }
-}