Преглед изворни кода

Fixes #1 - isLast not working as expected in Zend_Service_Amazon_SimpleDb_Page

Frank Brückner пре 11 година
родитељ
комит
4134b1be04
2 измењених фајлова са 22 додато и 3 уклоњено
  1. 0 1
      library/Zend/Service/Amazon/SimpleDb.php
  2. 22 2
      library/Zend/Service/Amazon/SimpleDb/Page.php

+ 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;
         $nextTokenNode = $response->getSimpleXMLDocument()->ListDomainsResult->NextToken;
         $nextToken     = (string)$nextTokenNode;
         $nextToken     = (string)$nextTokenNode;
-        $nextToken     = (trim($nextToken) === '') ? null : $nextToken;
 
 
         return new Zend_Service_Amazon_SimpleDb_Page($data, $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)
     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
      * Retrieve token
      *
      *
      * @return string|null
      * @return string|null