Skip to content
This repository was archived by the owner on Jan 30, 2020. It is now read-only.

Commit 328746d

Browse files
author
Shahar Evron
committed
Merge branch 'master' of git://git.zendframework.com/zf
5 parents aa85a81 + 2549b87 + 47be447 + b60e5b4 + c7d790d commit 328746d

File tree

2 files changed

+28
-2
lines changed

2 files changed

+28
-2
lines changed

src/Header/ProxyAuthenticate.php

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* @throws Exception\InvalidArgumentException
77
* @see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.33
88
*/
9-
class ProxyAuthenticate implements HeaderDescription
9+
class ProxyAuthenticate implements MultipleHeaderDescription
1010
{
1111

1212
public static function fromString($headerLine)
@@ -41,4 +41,17 @@ public function toString()
4141
return 'Proxy-Authenticate: ' . $this->getFieldValue();
4242
}
4343

44+
public function toStringMultipleHeaders(array $headers)
45+
{
46+
$strings = array($this->toString());
47+
foreach ($headers as $header) {
48+
if (!$header instanceof ProxyAuthenticate) {
49+
throw new Exception\RuntimeException(
50+
'The ProxyAuthenticate multiple header implementation can only accept an array of ProxyAuthenticate headers'
51+
);
52+
}
53+
$strings[] = $header->toString();
54+
}
55+
return implode("\r\n", $strings);
56+
}
4457
}

src/Header/WWWAuthenticate.php

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* @throws Exception\InvalidArgumentException
77
* @see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.47
88
*/
9-
class WWWAuthenticate implements HeaderDescription
9+
class WWWAuthenticate implements MultipleHeaderDescription
1010
{
1111

1212
public static function fromString($headerLine)
@@ -41,4 +41,17 @@ public function toString()
4141
return 'WWW-Authenticate: ' . $this->getFieldValue();
4242
}
4343

44+
public function toStringMultipleHeaders(array $headers)
45+
{
46+
$strings = array($this->toString());
47+
foreach ($headers as $header) {
48+
if (!$header instanceof WWWAuthenticate) {
49+
throw new Exception\RuntimeException(
50+
'The WWWAuthenticate multiple header implementation can only accept an array of WWWAuthenticate headers'
51+
);
52+
}
53+
$strings[] = $header->toString();
54+
}
55+
return implode("\r\n", $strings);
56+
}
4457
}

0 commit comments

Comments
 (0)