| @@ 80-99 (lines=20) @@ | ||
| 77 | /** |
|
| 78 | * {@inheritdoc} |
|
| 79 | */ |
|
| 80 | public function read($key) |
|
| 81 | { |
|
| 82 | $this->ensureBucketExists(); |
|
| 83 | $options = $this->getOptions($key); |
|
| 84 | ||
| 85 | try { |
|
| 86 | // Get remote object |
|
| 87 | $object = $this->service->getObject($options); |
|
| 88 | // If there's no metadata array set up for this object, set it up |
|
| 89 | if (!array_key_exists($key, $this->metadata) || !is_array($this->metadata[$key])) { |
|
| 90 | $this->metadata[$key] = []; |
|
| 91 | } |
|
| 92 | // Make remote ContentType metadata available locally |
|
| 93 | $this->metadata[$key]['ContentType'] = $object->getContentType(); |
|
| 94 | ||
| 95 | return $object->getBody()->getContentAsString(); |
|
| 96 | } catch (\Exception $e) { |
|
| 97 | return false; |
|
| 98 | } |
|
| 99 | } |
|
| 100 | ||
| 101 | /** |
|
| 102 | * {@inheritdoc} |
|
| @@ 79-98 (lines=20) @@ | ||
| 76 | /** |
|
| 77 | * {@inheritdoc} |
|
| 78 | */ |
|
| 79 | public function read($key) |
|
| 80 | { |
|
| 81 | $this->ensureBucketExists(); |
|
| 82 | $options = $this->getOptions($key); |
|
| 83 | ||
| 84 | try { |
|
| 85 | // Get remote object |
|
| 86 | $object = $this->service->getObject($options); |
|
| 87 | // If there's no metadata array set up for this object, set it up |
|
| 88 | if (!array_key_exists($key, $this->metadata) || !is_array($this->metadata[$key])) { |
|
| 89 | $this->metadata[$key] = []; |
|
| 90 | } |
|
| 91 | // Make remote ContentType metadata available locally |
|
| 92 | $this->metadata[$key]['ContentType'] = $object->get('ContentType'); |
|
| 93 | ||
| 94 | return (string) $object->get('Body'); |
|
| 95 | } catch (\Exception $e) { |
|
| 96 | return false; |
|
| 97 | } |
|
| 98 | } |
|
| 99 | ||
| 100 | /** |
|
| 101 | * {@inheritdoc} |
|