Skip to content

Commit 4bfe1db

Browse files
committed
createHandler: acceptableRequestMethods
1 parent 19918e3 commit 4bfe1db

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

src/WebServCo/JSONAPI/Contract/Factory/Handler/JSONAPIHandlerFactoryInterface.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,8 @@
1111
*/
1212
interface JSONAPIHandlerFactoryInterface
1313
{
14-
public function createHandler(): JSONAPIHandlerInterface;
14+
/**
15+
* @param array<int,string> $acceptableRequestMethods
16+
*/
17+
public function createHandler(array $acceptableRequestMethods): JSONAPIHandlerInterface;
1518
}

src/WebServCo/JSONAPI/Factory/Handler/JSONAPIDefaultHandlerFactory.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,14 @@ public function __construct(
2424
) {
2525
}
2626

27-
public function createHandler(): JSONAPIHandlerInterface
28-
{
27+
/**
28+
* @param array<int,string> $acceptableRequestMethods
29+
*/
30+
public function createHandler(
31+
array $acceptableRequestMethods = [RequestMethodInterface::METHOD_GET],
32+
): JSONAPIHandlerInterface {
2933
return new JSONAPIItemHandler(
30-
[
31-
RequestMethodInterface::METHOD_GET,
32-
],
34+
$acceptableRequestMethods,
3335
$this->dataExtractionContainer,
3436
$this->jsonApiRequestService,
3537
// no fields

0 commit comments

Comments
 (0)