summaryrefslogtreecommitdiff
path: root/vendor/fguillot/simple-queue/src/Job.php
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2017-10-25 16:22:10 -0700
committerFrederic Guillot <fred@kanboard.net>2017-10-25 16:22:10 -0700
commit9e2b2a32fd0e967ad3184e9a5d091a29953acb91 (patch)
tree00822e24aa1110c73ca455a8d096ef296c008cbc /vendor/fguillot/simple-queue/src/Job.php
parentc507c5416251c505cb3e088a03c6664bed73c812 (diff)
Include composer dependencies in repo
Diffstat (limited to 'vendor/fguillot/simple-queue/src/Job.php')
-rw-r--r--vendor/fguillot/simple-queue/src/Job.php98
1 files changed, 98 insertions, 0 deletions
diff --git a/vendor/fguillot/simple-queue/src/Job.php b/vendor/fguillot/simple-queue/src/Job.php
new file mode 100644
index 00000000..799bbba8
--- /dev/null
+++ b/vendor/fguillot/simple-queue/src/Job.php
@@ -0,0 +1,98 @@
+<?php
+
+namespace SimpleQueue;
+
+/**
+ * Class Job
+ *
+ * @package SimpleQueue
+ */
+class Job
+{
+ protected $id;
+ protected $body;
+
+ /**
+ * Job constructor.
+ *
+ * @param null $body
+ * @param null $id
+ */
+ public function __construct($body = null, $id = null)
+ {
+ $this->body = $body;
+ $this->id = $id;
+ }
+
+ /**
+ * Unserialize a payload
+ *
+ * @param string $payload
+ * @return $this
+ */
+ public function unserialize($payload)
+ {
+ $this->body = json_decode($payload, true);
+ return $this;
+ }
+
+ /**
+ * Serialize the body
+ *
+ * @return string
+ */
+ public function serialize()
+ {
+ return json_encode($this->body);
+ }
+
+ /**
+ * Set body
+ *
+ * @param mixed $body
+ * @return Job
+ */
+ public function setBody($body)
+ {
+ $this->body = $body;
+ return $this;
+ }
+
+ /**
+ * Get body
+ *
+ * @return mixed
+ */
+ public function getBody()
+ {
+ return $this->body;
+ }
+
+ /**
+ * Set job ID
+ *
+ * @param mixed $jobId
+ * @return Job
+ */
+ public function setId($jobId)
+ {
+ $this->id = $jobId;
+ return $this;
+ }
+
+ /**
+ * Get job ID
+ * @return mixed
+ */
+ public function getId()
+ {
+ return $this->id;
+ }
+
+ /**
+ * Execute job
+ */
+ public function execute()
+ {
+ }
+}