Skip to content

Commit 5f6c1fb

Browse files
committed
Replace public $id property with getter method
1 parent f2666e1 commit 5f6c1fb

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

src/GridFS/Bucket.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,8 +183,8 @@ public function getIdFromStream($stream)
183183
{
184184
$metadata = stream_get_meta_data($stream);
185185

186-
if (isset($metadata['wrapper_data']->id)) {
187-
return $metadata['wrapper_data']->id;
186+
if ($metadata['wrapper_data'] instanceof StreamWrapper) {
187+
return $metadata['wrapper_data']->getId();
188188
}
189189

190190
return;

src/GridFS/StreamWrapper.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,17 @@
1212
class StreamWrapper
1313
{
1414
public $context;
15-
public $id;
1615

1716
private $collectionsWrapper;
1817
private $gridFSStream;
18+
private $id;
1919
private $mode;
2020

21+
public function getId()
22+
{
23+
return $this->id;
24+
}
25+
2126
public function openReadStream()
2227
{
2328
$context = stream_context_get_options($this->context);

0 commit comments

Comments
 (0)