Merge pull request #5109 from colemanw/buttons
[civicrm-core.git] / CRM / Queue / Task.php
index f196a89ed5614b3b0f4fff92dd1be5384ef9f4de..8525c055c7c67e20e9b4810e9dd95ef46a0c9f63 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.5                                                |
+ | CiviCRM version 4.6                                                |
  +--------------------------------------------------------------------+
  | Copyright CiviCRM LLC (c) 2004-2014                                |
  +--------------------------------------------------------------------+
  | GNU Affero General Public License or the licensing of CiviCRM,     |
  | see the CiviCRM license FAQ at http://civicrm.org/licensing        |
  +--------------------------------------------------------------------+
-*/
+ */
 
 /**
  * A task is an item that can be enqueued and later exectued
  */
 class CRM_Queue_Task {
 
-  /** Task was performed successfully */
-  CONST TASK_SUCCESS = 1;
+  /**
+   * Task was performed successfully.
+   */
+  const TASK_SUCCESS = 1;
 
-  /** Task failed and should not be retried */
-  CONST TASK_FAIL = 2;
+  /**
+   * Task failed and should not be retried.
+   */
+  const TASK_FAIL = 2;
 
   /**
    * @var mixed, serializable
    */
-  var $callback;
+  public $callback;
 
   /**
    * @var array, serializable
    */
-  var $arguments;
+  public $arguments;
 
   /**
    * @var string, NULL-able
    */
-  var $title;
+  public $title;
 
   /**
-   * @param $callback mixed, serializable, a callable PHP item; must accept at least one argument (CRM_Queue_TaskContext)
-   * @param $arguments array, serializable, extra arguments to pass to the callback (in order)
-   * @param $title string, a printable string which describes this task
+   * @param mixed $callback
+   *   Serializable, a callable PHP item; must accept at least one argument
+   *   (CRM_Queue_TaskContext).
+   * @param array $arguments
+   *   Serializable, extra arguments to pass to the callback (in order).
+   * @param string $title
+   *   A printable string which describes this task.
    */
-  function __construct($callback, $arguments, $title = NULL) {
-    $this->callback  = $callback;
+  public function __construct($callback, $arguments, $title = NULL) {
+    $this->callback = $callback;
     $this->arguments = $arguments;
-    $this->title     = $title;
+    $this->title = $title;
   }
 
   /**
-   * Perform the task
+   * Perform the task.
    *
-   * @param $taskCtx array with keys:
-   *  - log: object 'Log'
+   * @param array $taskCtx
+   *   Array with keys:
+   *   - log: object 'Log'
    *
    * @throws Exception
    * @return bool, TRUE if task completes successfully
    */
-  function run($taskCtx) {
+  public function run($taskCtx) {
     $args = $this->arguments;
     array_unshift($args, $taskCtx);
 
@@ -83,5 +92,5 @@ class CRM_Queue_Task {
       throw new Exception('Failed to call callback: ' . print_r($this->callback));
     }
   }
-}
 
+}