File indexing completed on 2025-01-26 05:25:26

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_Service_Amazon
0017  * @subpackage SimpleDb
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  */
0021 
0022 /**
0023  * @see Zend_Service_Amazon_Exception
0024  */
0025 // require_once 'Zend/Service/Amazon/Exception.php';
0026 
0027 /**
0028  * The Custom Exception class that allows you to have access to the AWS Error Code.
0029  *
0030  * @category   Zend
0031  * @package    Zend_Service_Amazon
0032  * @subpackage SimpleDb
0033  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0034  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0035  */
0036 class Zend_Service_Amazon_SimpleDb_Page
0037 {
0038     /**
0039      * Page data
0040      *
0041      * @var string
0042      */
0043     protected $_data;
0044 
0045     /**
0046      * Token identifying page
0047      *
0048      * @var string|null
0049      */
0050     protected $_token;
0051 
0052     /**
0053      * Constructor
0054      *
0055      * @param string      $data
0056      * @param string|null $token
0057      */
0058     public function __construct($data, $token = null)
0059     {
0060         $this->setData($data);
0061         $this->setToken($token);
0062     }
0063 
0064     /**
0065      * Set page data
0066      *
0067      * @param string $data
0068      */
0069     public function setData($data)
0070     {
0071         $this->_data = $data;
0072     }
0073 
0074     /**
0075      * Retrieve page data
0076      *
0077      * @return string
0078      */
0079     public function getData()
0080     {
0081         return $this->_data;
0082     }
0083 
0084     /**
0085      * Set token
0086      *
0087      * @param string|null $token
0088      */
0089     public function setToken($token)
0090     {
0091         $this->_token = (trim($token) === '') ? null : $token;
0092     }
0093 
0094     /**
0095      * Retrieve token
0096      *
0097      * @return string|null
0098      */
0099     public function getToken()
0100     {
0101         return $this->_token;
0102     }
0103 
0104     /**
0105      * Determine whether this is the last page of data
0106      *
0107      * @return bool
0108      */
0109     public function isLast()
0110     {
0111         return (null === $this->_token);
0112     }
0113 
0114     /**
0115      * Cast to string
0116      *
0117      * @return string
0118      */
0119     public function __toString()
0120     {
0121         return "Page with token: " . $this->_token
0122              . "\n and data: " . $this->_data;
0123     }
0124 }