public function listKeys($prefix = '')
{
$options = array('Bucket' => $this->bucket);
if ((string) $prefix != '') {
$options['Prefix'] = $this->computePath($prefix);
} elseif (!empty($this->options['directory'])) {
$options['Prefix'] = $this->options['directory'];
}
$keys = array();
$iter = $this->service->getIterator('ListObjects', $options);
foreach ($iter as $file) {
$keys[] = $this->computeKey($file['Key']);
}
return $keys;
}
public function shouldListKeysWithoutDirectory() { $client = $this->getClient(); $adapter = new AwsS3($client, 'bucket', array('directory' => 'bar')); $adapter->write('test.txt', 'some content'); $keys = $adapter->listKeys(); $this->assertEquals('test.txt', $keys['key']); }