Skip to content

Commit

Permalink
refactor: improved Serializer
Browse files Browse the repository at this point in the history
  • Loading branch information
petrknap committed Apr 1, 2024
1 parent b823d61 commit 3a20cc8
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/Serializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@ class Serializer extends Serializer\Serializer
protected readonly Coder\CoderInterface $coder;
protected readonly Serializer\SerializerInterface $serializer;

public function __construct()
{
$this->coder = new Coder\Zlib();
$this->serializer = new Serializer\Php();
public function __construct(
?Coder\CoderInterface $coder = null,
?Serializer\SerializerInterface $serializer = null,
) {
$this->coder = $coder ?? new Coder\Zlib();
$this->serializer = $serializer ?? new Serializer\Php();
}

protected function doSerialize(mixed $serializable): string
Expand Down

0 comments on commit 3a20cc8

Please sign in to comment.