File indexing completed on 2025-03-02 05:29:36

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 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_Apns **/
0024 // require_once 'Zend/Mobile/Push/Apns.php';
0025 
0026 /**
0027  * Apns Test Proxy
0028  * This class is utilized for unit testing purposes
0029  *
0030  * @category   Zend
0031  * @package    Zend_Mobile
0032  * @subpackage Push
0033  */
0034 class Zend_Mobile_Push_Test_ApnsProxy extends Zend_Mobile_Push_Apns 
0035 {
0036     /**
0037      * Read Response
0038      *
0039      * @var string
0040      */
0041     protected $_readResponse;
0042 
0043     /**
0044      * Write Response
0045      *
0046      * @var mixed
0047      */
0048     protected $_writeResponse;
0049 
0050     /**
0051      * Set the Response
0052      *
0053      * @param string $str
0054      */
0055     public function setReadResponse($str) {
0056         $this->_readResponse = $str;
0057     }
0058 
0059     /**
0060      * Set the write response
0061      *
0062      * @param mixed $resp
0063      * @return void
0064      */
0065     public function setWriteResponse($resp)
0066     {
0067         $this->_writeResponse = $resp;
0068     }
0069 
0070     /**
0071      * Connect
0072      *
0073      * @return true
0074      */
0075     protected function _connect($uri) {
0076         return true;
0077     }
0078 
0079     /**
0080      * Return Response
0081      *
0082      * @param string $length
0083      * @return string
0084      */
0085     protected function _read($length) {
0086         $ret = substr($this->_readResponse, 0, $length);
0087         $this->_readResponse = null;
0088         return $ret;
0089     }
0090 
0091     /**
0092      * Write and Return Length
0093      *
0094      * @param string $payload
0095      * @return int
0096      */
0097     protected function _write($payload) {
0098         $ret = $this->_writeResponse;
0099         $this->_writeResponse = null;
0100         return (null === $ret) ? strlen($payload) : $ret;
0101     }
0102 }