File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ use Nyholm\Psr7\Factory\Psr17Factory;
2424
2525$httpClient = new Psr18Client();
2626$psr17Factory = new Psr17Factory();
27- $ipdata = new Ipdata($httpClient, 'my_api_key', $psr17Factory);
27+ $ipdata = new Ipdata('my_api_key', $httpClient , $psr17Factory);
2828```
2929
3030## How to use
Original file line number Diff line number Diff line change @@ -37,12 +37,12 @@ class Ipdata
3737 private $ requestFactory ;
3838
3939 /**
40- * Get an instance of the API client. Give it PSR-18 client, an API key and a PSR-17 request factory.
40+ * Get an instance of the API client. Give it an API key, a PSR-18 client and a PSR-17 request factory.
4141 *
4242 * @param ClientInterface|null $httpClient if null, we will try to use php-http/discovery to find an installed client
4343 * @param RequestFactoryInterface|null $requestFactory if null, we will try to use php-http/discovery to find an installed factory
4444 */
45- public function __construct (ClientInterface $ httpClient = null , ? string $ apiKey = null , RequestFactoryInterface $ requestFactory = null )
45+ public function __construct (string $ apiKey , ClientInterface $ httpClient = null , RequestFactoryInterface $ requestFactory = null )
4646 {
4747 if (null === $ httpClient ) {
4848 if (!class_exists (Psr18ClientDiscovery::class)) {
Original file line number Diff line number Diff line change @@ -137,13 +137,13 @@ public function testParseInvalidJsonResponse()
137137
138138 public function testConstructWithDiscovery ()
139139 {
140- $ ipdata = new Ipdata (null , 'secret_key ' );
140+ $ ipdata = new Ipdata ('secret_key ' );
141141 $ this ->assertInstanceOf (Ipdata::class, $ ipdata );
142142 }
143143
144144 private function createIpdata (ClientInterface $ httpClient ): Ipdata
145145 {
146- return new Ipdata ($ httpClient , 'secret_key ' , new Psr17Factory ());
146+ return new Ipdata ('secret_key ' , $ httpClient , new Psr17Factory ());
147147 }
148148
149149 private function createResponse (array $ data = [], int $ statusCode = 200 ): ResponseInterface
You can’t perform that action at this time.
0 commit comments