Skip to content

Commit 0857b53

Browse files
committed
Add Stringable on storage attributes
1 parent 22af5a3 commit 0857b53

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

src/DirectoryAttributes.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
namespace League\Flysystem;
66

7-
class DirectoryAttributes implements StorageAttributes
7+
class DirectoryAttributes implements StorageAttributes, \Stringable
88
{
99
use ProxyArrayAccessToProperties;
1010
private string $type = StorageAttributes::TYPE_DIRECTORY;
@@ -84,4 +84,9 @@ public function jsonSerialize(): array
8484
StorageAttributes::ATTRIBUTE_EXTRA_METADATA => $this->extraMetadata,
8585
];
8686
}
87+
88+
public function __toString(): string
89+
{
90+
return sprintf('%s(%s)', $this->type, $this->path);
91+
}
8792
}

src/FileAttributes.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
namespace League\Flysystem;
66

7-
class FileAttributes implements StorageAttributes
7+
class FileAttributes implements StorageAttributes, \Stringable
88
{
99
use ProxyArrayAccessToProperties;
1010
private string $type = StorageAttributes::TYPE_FILE;
@@ -97,4 +97,9 @@ public function jsonSerialize(): array
9797
StorageAttributes::ATTRIBUTE_EXTRA_METADATA => $this->extraMetadata,
9898
];
9999
}
100+
101+
public function __toString(): string
102+
{
103+
return sprintf('%s(%s)', $this->type, $this->path);
104+
}
100105
}

0 commit comments

Comments
 (0)