Code Duplication    Length = 19-19 lines in 2 locations

src/Gaufrette/Adapter/AwsS3.php 1 location

@@ 196-214 (lines=19) @@
193
    /**
194
     * {@inheritdoc}
195
     */
196
    public function listKeys($prefix = '')
197
    {
198
        $this->ensureBucketExists();
199
200
        $options = ['Bucket' => $this->bucket];
201
        if ((string) $prefix != '') {
202
            $options['Prefix'] = $this->computePath($prefix);
203
        } elseif (!empty($this->options['directory'])) {
204
            $options['Prefix'] = $this->options['directory'];
205
        }
206
207
        $keys = [];
208
        $iter = $this->service->getIterator('ListObjects', $options);
209
        foreach ($iter as $file) {
210
            $keys[] = $this->computeKey($file['Key']);
211
        }
212
213
        return $keys;
214
    }
215
216
    /**
217
     * {@inheritdoc}

src/Gaufrette/Adapter/AsyncAwsS3.php 1 location

@@ 202-220 (lines=19) @@
199
    /**
200
     * {@inheritdoc}
201
     */
202
    public function listKeys($prefix = '')
203
    {
204
        $this->ensureBucketExists();
205
206
        $options = ['Bucket' => $this->bucket];
207
        if ((string) $prefix != '') {
208
            $options['Prefix'] = $this->computePath($prefix);
209
        } elseif (!empty($this->options['directory'])) {
210
            $options['Prefix'] = $this->options['directory'];
211
        }
212
213
        $keys = [];
214
        $result = $this->service->listObjectsV2($options);
215
        foreach ($result->getContents() as $file) {
216
            $keys[] = $this->computeKey($file->getKey());
217
        }
218
219
        return $keys;
220
    }
221
222
    /**
223
     * {@inheritdoc}