File indexing completed on 2025-03-02 05:29:35
0001 <?php 0002 /** 0003 * Zend Framework 0004 * 0005 * LICENSE 0006 * 0007 * This source file is subject to the new BSD license that is bundled 0008 * with this package in the file LICENSE.txt. 0009 * It is also available through the world-wide-web at this URL: 0010 * http://framework.zend.com/license/new-bsd 0011 * If you did not receive a copy of the license and are unable to 0012 * obtain it through the world-wide-web, please send an email 0013 * to license@zend.com so we can send you a copy immediately. 0014 * 0015 * @category Zend 0016 * @package Zend_Mobile 0017 * @subpackage Zend_Mobile_Push 0018 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) 0019 * @license http://framework.zend.com/license/new-bsd New BSD License 0020 * @version $Id$ 0021 */ 0022 0023 /** Zend_Mobile_Push_Message_Interface **/ 0024 // require_once 'Zend/Mobile/Push/Message/Interface.php'; 0025 0026 /** Zend_Mobile_Push_Message_Exception **/ 0027 // require_once 'Zend/Mobile/Push/Message/Exception.php'; 0028 0029 /** 0030 * Message Abstract 0031 * 0032 * @category Zend 0033 * @package Zend_Mobile 0034 * @subpackage Zend_Mobile_Push_Message 0035 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) 0036 * @license http://framework.zend.com/license/new-bsd New BSD License 0037 * @version $Id$ 0038 */ 0039 abstract class Zend_Mobile_Push_Message_Abstract implements Zend_Mobile_Push_Message_Interface 0040 { 0041 /** 0042 * Token 0043 * 0044 * @var string 0045 */ 0046 protected $_token; 0047 0048 /** 0049 * Id 0050 * 0051 * @var int|string|float|bool Scalar 0052 */ 0053 protected $_id; 0054 0055 /** 0056 * Get Token 0057 * 0058 * @return string 0059 */ 0060 public function getToken() 0061 { 0062 return $this->_token; 0063 } 0064 0065 /** 0066 * Set Token 0067 * 0068 * @param string $token 0069 * @throws Zend_Mobile_Push_Message_Exception 0070 * @return Zend_Mobile_Push_Message_Abstract 0071 */ 0072 public function setToken($token) 0073 { 0074 if (!is_string($token)) { 0075 throw new Zend_Mobile_Push_Message_Exception('$token must be a string'); 0076 } 0077 $this->_token = $token; 0078 return $this; 0079 } 0080 0081 /** 0082 * Get Message ID 0083 * 0084 * @return int|string|float|bool Scalar 0085 */ 0086 public function getId() 0087 { 0088 return $this->_id; 0089 } 0090 0091 /** 0092 * Set Message ID 0093 * 0094 * @param int|string|float|bool $id Scalar 0095 * @return Zend_Mobile_Push_Message_Abstract 0096 * @throws Exception 0097 */ 0098 public function setId($id) 0099 { 0100 if (!is_scalar($id)) { 0101 throw new Zend_Mobile_Push_Message_Exception('$id must be a scalar'); 0102 } 0103 $this->_id = $id; 0104 return $this; 0105 } 0106 0107 /** 0108 * Set Options 0109 * 0110 * @param array $options 0111 * @return Zend_Mobile_Push_Message_Abstract 0112 * @throws Zend_Mobile_Push_Message_Exception 0113 */ 0114 public function setOptions(array $options) 0115 { 0116 foreach ($options as $k => $v) { 0117 $method = 'set' . ucwords($k); 0118 if (!method_exists($this, $method)) { 0119 throw new Zend_Mobile_Push_Message_Exception('The method "' . $method . "' does not exist."); 0120 } 0121 $this->$method($v); 0122 } 0123 return $this; 0124 } 0125 0126 0127 /** 0128 * Validate Message format 0129 * 0130 * @return boolean 0131 */ 0132 public function validate() 0133 { 0134 return true; 0135 } 0136 }