_data[$key] = $value; return $this; } /** * Set Data * * @param array $data * @return Zend_Mobile_Push_Message_C2dm * @throws Zend_Mobile_Push_Message_Exception */ public function setData(array $data) { $this->clearData(); foreach ($data as $k => $v) { $this->addData($k, $v); } return $this; } /** * Clear Data * * @return Zend_Mobile_Push_Message_C2dm */ public function clearData() { $this->_data = array(); } /** * Get Data * * @return array */ public function getData() { return $this->_data; } /** * Set Delay While Idle * * @param boolean $delay * @return Zend_Mobile_Push_Message_C2dm * @throws Zend_Mobile_Push_Message_Exception */ public function setDelayWhileIdle($delay) { if (!is_bool($delay)) { throw new Zend_Mobile_Push_Message_Exception('$delay must be boolean'); } $this->_delay = $delay; return $this; } /** * Get Delay While Idle * * @return boolean */ public function getDelayWhileIdle() { return $this->_delay; } /** * Validate this is a proper C2dm message * Does not validate size. * * @return boolean */ public function validate() { if (!is_string($this->_token) || strlen($this->_token) === 0) { return false; } if (!is_scalar($this->_id) || strlen($this->_id) === 0) { return false; } return true; } }