Skip to content

Commit

Permalink
tabs -> spaces fix
Browse files Browse the repository at this point in the history
  • Loading branch information
jonnott committed Nov 21, 2011
1 parent 2d60f84 commit 9135b58
Showing 1 changed file with 45 additions and 45 deletions.
90 changes: 45 additions & 45 deletions library/Zend/Service/Amazon/S3/S3.php
Original file line number Diff line number Diff line change
Expand Up @@ -299,52 +299,52 @@ public function getObjectsByBucket($bucket, $params = array())
return $objects;
}

/**
* List the objects and common prefixes in a bucket.
*
* Provides the list of object keys and common prefixes that are contained in the bucket. Valid params include the following.
* prefix - Limits the response to keys which begin with the indicated prefix. You can use prefixes to separate a bucket into different sets of keys in a way similar to how a file system uses folders.
* marker - Indicates where in the bucket to begin listing. The list will only include keys that occur lexicographically after marker. This is convenient for pagination: To get the next page of results use the last key of the current page as the marker.
* max-keys - The maximum number of keys you'd like to see in the response body. The server might return fewer than this many keys, but will not return more.
* delimiter - Causes keys that contain the same string between the prefix and the first occurrence of the delimiter to be rolled up into a single result element in the CommonPrefixes collection. These rolled-up keys are not returned elsewhere in the response.
*
* @param string $bucket
* @param array $params S3 GET Bucket Paramater
* @return array|false
*/
public function getObjectsAndPrefixesByBucket($bucket, $params = array())
{
$response = $this->_makeRequest('GET', $bucket, $params);

if ($response->getStatus() != 200) {
return false;
}

$xml = new \SimpleXMLElement($response->getBody());

$objects = array();
if (isset($xml->Contents)) {
foreach ($xml->Contents as $contents) {
foreach ($contents->Key as $object) {
$objects[] = (string)$object;
}
}
}
$prefixes = array();
if (isset($xml->CommonPrefixes)) {
foreach ($xml->CommonPrefixes as $prefix) {
foreach ($prefix->Prefix as $object) {
$prefixes[] = (string)$object;
}
}
}

return array(
'objects' => $objects,
'prefixes' => $prefixes
);
}
/**
* List the objects and common prefixes in a bucket.
*
* Provides the list of object keys and common prefixes that are contained in the bucket. Valid params include the following.
* prefix - Limits the response to keys which begin with the indicated prefix. You can use prefixes to separate a bucket into different sets of keys in a way similar to how a file system uses folders.
* marker - Indicates where in the bucket to begin listing. The list will only include keys that occur lexicographically after marker. This is convenient for pagination: To get the next page of results use the last key of the current page as the marker.
* max-keys - The maximum number of keys you'd like to see in the response body. The server might return fewer than this many keys, but will not return more.
* delimiter - Causes keys that contain the same string between the prefix and the first occurrence of the delimiter to be rolled up into a single result element in the CommonPrefixes collection. These rolled-up keys are not returned elsewhere in the response.
*
* @param string $bucket
* @param array $params S3 GET Bucket Paramater
* @return array|false
*/
public function getObjectsAndPrefixesByBucket($bucket, $params = array())
{
$response = $this->_makeRequest('GET', $bucket, $params);

if ($response->getStatus() != 200) {
return false;
}

$xml = new \SimpleXMLElement($response->getBody());

$objects = array();
if (isset($xml->Contents)) {
foreach ($xml->Contents as $contents) {
foreach ($contents->Key as $object) {
$objects[] = (string)$object;
}
}
}
$prefixes = array();
if (isset($xml->CommonPrefixes)) {
foreach ($xml->CommonPrefixes as $prefix) {
foreach ($prefix->Prefix as $object) {
$prefixes[] = (string)$object;
}
}
}

return array(
'objects' => $objects,
'prefixes' => $prefixes
);
}

/**
* Make sure the object name is valid
*
Expand Down

0 comments on commit 9135b58

Please sign in to comment.