Skip to content

Commit

Permalink
$content
Browse files Browse the repository at this point in the history
  • Loading branch information
z985342160 committed Aug 9, 2024
1 parent cfd49ac commit 1f7277d
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/Encoder/EncoderInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@

interface EncoderInterface
{
public function decode(string $content, array $context = []): mixed;
public function decode(string $content, array $context = []): array;
}
4 changes: 1 addition & 3 deletions src/Encoder/JsonEncoder.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,12 @@

class JsonEncoder extends AbstractEncoder
{
public function decode(ResponseInterface $response, array $context = []): mixed
public function decode(string $content, array $context = []): array
{
$context = array_merge($this->defaultContext, $context);

$encoder = new SymfonyJsonEncoder();

$content = (string)$response->getBody();

return $encoder->decode($content, SymfonyJsonEncoder::FORMAT, $context);
}
}
4 changes: 1 addition & 3 deletions src/Encoder/XmlEncoder.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,12 @@

class XmlEncoder extends AbstractEncoder
{
public function decode(ResponseInterface $response, array $context = []): mixed
public function decode(string $content, array $context = []): array
{
$context = array_merge($this->defaultContext, $context);

$encoder = new SymfonyXmlEncoder();

$content = (string)$response->getBody();

return $encoder->decode($content, SymfonyXmlEncoder::FORMAT, $context);
}
}

0 comments on commit 1f7277d

Please sign in to comment.