public function __construct($mixed) { if (is_array($mixed)) { return parent::__construct($mixed); } $this->setBody($mixed); }
/** * We adjusted the constructor to accept both an array and an object. */ public function __construct($mixed) { // we still have to support the code in Zend_Queue::receive that // passes in an array if (is_array($mixed)) { parent::__construct($mixed); } elseif (is_object($mixed)) { $this->setBody($mixed); $this->_connected = false; } }
/** * Constructor * * The constructor should be an array of options. * * If the option 'data' is provided, and is an instance of ZendApi_Job, * that object will be used as the internal job; if that option is not a * ZendApi_Job instance, an exception will be thrown. * * Alternately, you may specify the 'script' parameter, which should be a * JobQueue script the job will request. A new ZendApi_Job object will then * be created using that script and any options you provide. * * @param array $options * @return void * @throws Zend_Queue_Exception */ public function __construct(array $options = array()) { if (isset($options['data'])) { if (!$options['data'] instanceof ZendApi_Job) { throw new Zend_Queue_Exception('Data must be an instance of ZendApi_Job'); } $this->_job = $options['data']; parent::__construct($this->_job->getProperties()); } else { parent::__construct($options); if (!isset($options['script'])) { throw new Zend_Queue_Exception('The script is mandatory data'); } $this->_job = new ZendApi_Job($options['script']); $this->_setJobProperties(); } }