Total Complexity | 2 |
Total Lines | 28 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
23 | class CompressedJsonEncoder implements EncoderInterface |
||
24 | { |
||
25 | const DEFAULT_COMPRESSION_LEVEL = -1; |
||
26 | |||
27 | private JsonEncoder $jsonEncoder; |
||
28 | |||
29 | /** |
||
30 | * Class constructor |
||
31 | * |
||
32 | * Allows the specification of the gzip compression-level |
||
33 | */ |
||
34 | public function __construct( |
||
35 | private int $compressionLevel = self::DEFAULT_COMPRESSION_LEVEL |
||
36 | ) { |
||
37 | $this->jsonEncoder = new JsonEncoder(); |
||
38 | } |
||
39 | |||
40 | /** |
||
41 | 7 | * Encodes a given message |
|
42 | * |
||
43 | * @param MessageInterface $message |
||
44 | 7 | * @return string |
|
45 | 7 | */ |
|
46 | 7 | public function encode(MessageInterface $message): string |
|
51 | } |
||
52 | } |
||
53 |