File tree Expand file tree Collapse file tree 1 file changed +19
-4
lines changed Expand file tree Collapse file tree 1 file changed +19
-4
lines changed Original file line number Diff line number Diff line change 5
5
namespace PetrKnap \Binary ;
6
6
7
7
use PetrKnap \Shorts \Exception ;
8
+ use Stringable ;
8
9
9
10
/**
10
11
* @internal please use subclass
13
14
*
14
15
* @implements CoderInterface<Exception\CouldNotProcessData>
15
16
*/
16
- abstract class Coder implements CoderInterface
17
+ abstract class Coder implements CoderInterface, Stringable
17
18
{
18
- public function __construct (
19
- protected readonly string $ data = '' ,
19
+ /**
20
+ * @param string $data may contain binary data
21
+ */
22
+ final public function __construct (
23
+ public readonly string $ data = '' ,
20
24
) {
21
25
}
22
26
@@ -25,7 +29,18 @@ public function withData(string $data): static
25
29
return static ::create ($ this , $ data );
26
30
}
27
31
28
- public function getData (): string
32
+ /**
33
+ * @deprecated use readonly property {@see self::$data}
34
+ */
35
+ final public function getData (): string
36
+ {
37
+ return $ this ->data ;
38
+ }
39
+
40
+ /**
41
+ * @note this is just a helper, this class is not supposed to implement {@see BinariableInterface}
42
+ */
43
+ public function __toString (): string
29
44
{
30
45
return $ this ->data ;
31
46
}
You can’t perform that action at this time.
0 commit comments