Explorar o código

Added context information to event

Michael Sivolobov %!s(int64=10) %!d(string=hai) anos
pai
achega
bb9fd57eda
Modificáronse 1 ficheiros con 23 adicións e 0 borrados
  1. 23 0
      Event/Abstracts/AbstractGearmanClientTaskEvent.php

+ 23 - 0
Event/Abstracts/AbstractGearmanClientTaskEvent.php

@@ -28,6 +28,13 @@ abstract class AbstractGearmanClientTaskEvent extends Event
      */
     protected $gearmanTask;
 
+    /**
+     * @var mixed
+     *
+     * Context that can be set in the addTask method
+     */
+    protected $context;
+
     /**
      * Construct method
      *
@@ -47,4 +54,20 @@ abstract class AbstractGearmanClientTaskEvent extends Event
     {
         return $this->gearmanTask;
     }
+
+    /**
+     * @param mixed $context Context that can be set in the addTask method
+     */
+    public function setContext($context)
+    {
+        $this->context = &$context['context'];
+    }
+
+    /**
+     * @return mixed Context that can be set in the addTask method
+     */
+    public function &getContext()
+    {
+        return $this->context;
+    }
 }