<?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
+ * @param array $taskCtx
+ * Array with keys:
+ * - log: object 'Log'
*
* @throws Exception
- * @internal param array $taskContext with keys:
- * - log: object 'Log'
- *
* @return bool, TRUE if task completes successfully
*/
- function run($taskCtx) {
+ public function run($taskCtx) {
$args = $this->arguments;
array_unshift($args, $taskCtx);
throw new Exception('Failed to call callback: ' . print_r($this->callback));
}
}
-}
+}