Skip to content

Commit

Permalink
add all factories supported by psr17 discovery
Browse files Browse the repository at this point in the history
  • Loading branch information
dbu committed Sep 29, 2022
1 parent 671f98c commit a708a73
Showing 1 changed file with 32 additions and 2 deletions.
34 changes: 32 additions & 2 deletions discovery.rst
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,40 @@ This type of discovery finds a factory for a PSR-17_ implementation::
*/
private $responseFactory;

public function __construct(RequestFactoryInterface $requestFactory = null, ResponseFactoryInterface $responseFactory = null)
{
/**
* @var ServerRequestFactoryInterface
*/
private $serverRequestFactory;

/**
* @var StreamFactoryInterface
*/
private $streamFactory;

/**
* @var UploadedFileFactoryInterface
*/
private $uploadedFileFactory;

/**
* @var UriFactoryInterface
*/
private $uriFactory;

public function __construct(
RequestFactoryInterface $requestFactory = null,
ResponseFactoryInterface $responseFactory = null,
ServerRequestFactoryInterface $serverRequestFactory = null,
StreamFactoryInterface $streamFactory = null,
UploadedFileFactoryInterface $uploadedFileFactory = null,
UriFactoryInterface = $uriFactoryInterface = null
) {
$this->requestFactory = $requestFactory ?: Psr17FactoryDiscovery::findRequestFactory();
$this->responseFactory = $responseFactory ?: Psr17FactoryDiscovery::findResponseFactory();
$this->serverRequestFactory = $serverRequestFactory ?: Psr17FactoryDiscovery::findServerRequestFactory();
$this->streamFactory = $streamFactory ?: Psr17FactoryDiscovery::findStreamFactory();
$this->uploadedFileFactory = $uploadedFileFactory ?: Psr17FactoryDiscovery::findUploadedFileFactory();
$this->uriFactory = $uriFactory ?: Psr17FactoryDiscovery::findUriFactory();
}
}

Expand Down

0 comments on commit a708a73

Please sign in to comment.