File tree Expand file tree Collapse file tree 1 file changed +19
-2
lines changed Expand file tree Collapse file tree 1 file changed +19
-2
lines changed Original file line number Diff line number Diff line change 44
55namespace PetrKnap \Binary ;
66
7+ use Stringable ;
8+
79/**
810 * @internal shared logic
911 */
10- abstract class Coder
12+ abstract class Coder implements Stringable
1113{
14+ /**
15+ * @param string $data may contain binary data
16+ */
1217 final public function __construct (
1318 public readonly string $ data = '' ,
1419 ) {
@@ -20,7 +25,9 @@ final public function withData(string $data): static
2025 }
2126
2227 /**
23- * @deprecated use readonly property $data
28+ * @deprecated use readonly property {@see self::$data}
29+ *
30+ * @return string may contain binary data
2431 */
2532 final public function getData (): string
2633 {
@@ -61,4 +68,14 @@ abstract public function xz(): static;
6168 * @throws Coder\Exception\CoderException
6269 */
6370 abstract public function zlib (): static ;
71+
72+ /**
73+ * @note this is just a helper, this class is not supposed to implement {@see BinariableInterface}
74+ *
75+ * @return string may contain binary data
76+ */
77+ public function __toString (): string
78+ {
79+ return $ this ->data ;
80+ }
6481}
You can’t perform that action at this time.
0 commit comments