Просмотр исходного кода

Fixes #1 - isLast not working as expected in Zend_Service_Amazon_SimpleDb_Page

Frank Brückner 11 лет назад
Родитель
Сommit
4134b1be04

+ 0 - 1
library/Zend/Service/Amazon/SimpleDb.php

@@ -307,7 +307,6 @@ class Zend_Service_Amazon_SimpleDb extends Zend_Service_Amazon_Abstract
 
         $nextTokenNode = $response->getSimpleXMLDocument()->ListDomainsResult->NextToken;
         $nextToken     = (string)$nextTokenNode;
-        $nextToken     = (trim($nextToken) === '') ? null : $nextToken;
 
         return new Zend_Service_Amazon_SimpleDb_Page($data, $nextToken);
     }

+ 22 - 2
library/Zend/Service/Amazon/SimpleDb/Page.php

@@ -50,8 +50,18 @@ class Zend_Service_Amazon_SimpleDb_Page
      */
     public function __construct($data, $token = null)
     {
-        $this->_data  = $data;
-        $this->_token = $token;
+        $this->setData($data);
+        $this->setToken($token);
+    }
+
+    /**
+     * Set page data
+     *
+     * @param string $data
+     */
+    public function setData($data)
+    {
+        $this->_data = $data;
     }
 
     /**
@@ -65,6 +75,16 @@ class Zend_Service_Amazon_SimpleDb_Page
     }
 
     /**
+     * Set token
+     *
+     * @param string|null $token
+     */
+    public function setToken($token)
+    {
+        $this->_token = (trim($token) === '') ? null : $token;
+    }
+
+    /**
      * Retrieve token
      *
      * @return string|null