Skip to content

Commit 11c3ffc

Browse files
author
Greg Bowler
committed
Register response class against accept header
1 parent 08fe431 commit 11c3ffc

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/ResponseFactory.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,16 @@ public static function create(RequestInterface $request):Response {
4343
* to be registered to match the request's "accept" header. This allows the web client to
4444
* request a web page in HTML format, over a web API in JSON format, for example.
4545
*/
46-
public static function registerResponseClass(string $class, string...$accept):void {
46+
public static function registerResponseClass(
47+
string $responseClassName,
48+
string...$accept
49+
):void {
4750
if(empty($accept)) {
4851
$accept = [self::DEFAULT_ACCEPT];
4952
}
5053

5154
foreach($accept as $a) {
52-
static::$responseClassLookup [$a] = $class;
55+
static::$responseClassLookup [$a] = $responseClassName;
5356
}
5457
}
5558
}

0 commit comments

Comments
 (0)