*Not reusable/resettable objects it`s potential problem in future.* *Yes, we can send factories or add empty instances, but it's harder than add method to reset content.*
My current code: abstract class HttpGateway extends Gateway { protected $client; protected $request; protected $dataSeparator; public function __construct(ClientInterface $client, RequestFactoryInterface $factory) { $this->client = $client; // Checks properties because extended class can overwrite them. if (! $this->request) { $this->request = $factory->createRequest('GET', $this->getUrl ()); } if (! $this->dataSeparator) { $this->dataSeparator = ini_get('arg_separator.output') ?: '&'; } } protected function sendRequest(array $data) { $data = http_build_query($data, '', $this->dataSeparator, PHP_QUERY_RFC3986); if ($this->request->getMethod() == 'POST') { $request = clone $this->request; $request->getBody()->write($data); } else { $uri = $request->getUri()->withQuery($data); $request = $this->request->withUri($uri, true); } $response = $this->client->sendRequest($request); return $this->parseResponse($response); } } *As result: I can`t use PSR-7 without PSR-17, than why not merge it and adds exception iterfaces?* > -- You received this message because you are subscribed to the Google Groups "PHP Framework Interoperability Group" group. To unsubscribe from this group and stop receiving emails from it, send an email to php-fig+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/php-fig/8119ec75-c695-4d3e-9991-ca969d4d466f%40googlegroups.com.