This repository was archived by the owner on Jan 30, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +28
-2
lines changed
Expand file tree Collapse file tree 2 files changed +28
-2
lines changed Original file line number Diff line number Diff line change 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}
Original file line number Diff line number Diff line change 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}
You can’t perform that action at this time.
0 commit comments