File tree 1 file changed +15
-2
lines changed
1 file changed +15
-2
lines changed Original file line number Diff line number Diff line change 4
4
5
5
namespace PetrKnap \Binary ;
6
6
7
+ use Stringable ;
8
+
7
9
/**
8
10
* @internal shared logic
9
11
*/
10
- abstract class Coder
12
+ abstract class Coder implements Stringable
11
13
{
14
+ /**
15
+ * @param string $data may contain binary data
16
+ */
12
17
final public function __construct (
13
18
public readonly string $ data = '' ,
14
19
) {
@@ -20,7 +25,7 @@ final public function withData(string $data): static
20
25
}
21
26
22
27
/**
23
- * @deprecated use readonly property $data
28
+ * @deprecated use readonly property {@see self:: $data}
24
29
*/
25
30
final public function getData (): string
26
31
{
@@ -61,4 +66,12 @@ abstract public function xz(): static;
61
66
* @throws Coder\Exception\CoderException
62
67
*/
63
68
abstract public function zlib (): static ;
69
+
70
+ /**
71
+ * @note this is just a helper, this class is not supposed to implement {@see BinariableInterface}
72
+ */
73
+ public function __toString (): string
74
+ {
75
+ return $ this ->data ;
76
+ }
64
77
}
You can’t perform that action at this time.
0 commit comments