Skip to content

Commit

Permalink
psr/http-message version to >=1.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
marekminarik committed Aug 6, 2024
1 parent 52e4e7d commit c1b8cb1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"require": {
"php": "^7.3 || ^8.0",
"psr/log": "^1.1|^2|^3",
"psr/http-message": "^2.0"
"psr/http-message": "^1.0.1|^2"
},
"require-dev": {
"codeception/codeception": "^4.2 || ^5.0",
Expand Down
16 changes: 8 additions & 8 deletions src/Http/PsrResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class PsrResponse implements MessageInterface
* @var array<string, array<string>>
*/
private $headers;

/**
* @var StreamInterface
*/
Expand All @@ -27,30 +27,30 @@ public function getHeaders(): array
return $this->headers;
}

public function hasHeader(string $name): bool
public function hasHeader($name): bool
{
return isset($this->headers[$name]);
}

public function getHeader(string $name): array
public function getHeader($name): array
{
return $this->headers[$name] ?? [];
}

public function getHeaderLine(string $name): string
public function getHeaderLine($name): string
{
return join(", ", $this->getHeader($name));
}

public function withHeader(string $name, $value): MessageInterface
public function withHeader($name, $value): MessageInterface
{
$out = clone $this;
$out->headers[$name] = is_array($value) ? $value : [$value];

return $out;
}

public function withAddedHeader(string $name, $value): MessageInterface
public function withAddedHeader($name, $value): MessageInterface
{
$out = clone $this;

Expand All @@ -62,7 +62,7 @@ public function withAddedHeader(string $name, $value): MessageInterface
return $out;
}

public function withoutHeader(string $name): MessageInterface
public function withoutHeader($name): MessageInterface
{
$out = clone $this;
unset($out->headers[$name]);
Expand All @@ -88,7 +88,7 @@ public function getProtocolVersion(): string
return $this->protocolVersion;
}

public function withProtocolVersion(string $version): MessageInterface
public function withProtocolVersion($version): MessageInterface
{
$out = clone $this;
$out->protocolVersion = $version;
Expand Down

0 comments on commit c1b8cb1

Please sign in to comment.